GtkImage: image from file not displayed at its 1:1 scale
Steps to reproduce
- Create a
GtkImage
from a file, preferably a HD picture (use UI sample below) - Observe the resulting image
Current behavior
Image is not 1:1 scaled, smaller than expected.
Expected outcome
Image should be 1:1 scaled, just like in Gtk3.
Version information
gtk-4.10.1
No global scaling (GDK_SCALE undefined)
Tested on Opensuse Tumbleweed (up-to-date), X11 (MATE desktop)
Additional information
- it doesn't matter if the image is placed in a GtkScrolledWindow+GtkViewport, or directly as child of a GtkWindow.
- starting the GTK-inspector tool and playing with the various align/expand/scroll-policy/propagate-natural properties never succeeds in displaying the image at its 1:1 scale.
- forcing height-request/width-request to the original image size also doesn't help, the displayed image is still smaller than expected, and wide margins are seen around.
- I also made some tests with a
GtkPicture
(align=center) and observed similar wide margins around the displayed image.
Here an UI sample for testing, display with gtk4-builder-tool preview
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkWindow" id="mainwin">
<property name="default-width">1100</property>
<property name="default-height">650</property>
<child>
<object class="GtkScrolledWindow">
<property name="has-frame">0</property>
<property name="child">
<object class="GtkViewport">
<property name="child">
<object class="GtkImage">
<property name="file">/path/to/whatever.jpg</property>
</object>
</property>
</object>
</property>
</object>
</child>
</object>
</interface>