inconsistent and problematic pixel snapping behavior when image url is updated
Summary:
When breaking and editing an image's xlink:href
url from Inkscape's interface, whether it's from the Object attributes panel or the xml editor, the image's width will snap to the pixel grid of the placeholder image:
This is already problematic for reasons explained below but it gets worse: depending on the original image's width, each time the url is updated, the image's width will either stay in place or increase by one pixel.
Note : this appeared since the 1.2 placeholder image was introduced. You can even see this behavior in the gif of that very merge request (the width value changes slightly when the url is edited).
Steps to reproduce:
- Download photo and bug.svg
- Open bug.svg
- Right-click on the top image and select "Image properties..." to open the Object attributes panel
- edit the URL field by either typing or erasing random characters
What happened?
-
if you do it on the top image, the width will snap to the pixel grid once and then stay in place as you keep updating the url.
-
if you do it on the bottom image, it will increase by one pixel each time the url is updated.
Why this is problematic either way:
If you fix the url in Inkscape by matching it with an existing file, the image's width will snap back to fit the image, which is great. However, if instead of fixing the url from Inkscape's interface you save the svg, open it in a text editor and fix the url there, that "snapping back" won't happen and the increased width will stay when you reopen the svg in Inkscape, thus deforming the image, even though you never asked for it.
Version info
Inkscape 1.2.2 (b0a8486, 2022-12-01)
GLib version: 2.64.6
GTK version: 3.24.20
glibmm version: 2.64.2
gtkmm version: 3.24.2
libxml2 version: 2.9.10
libxslt version: 1.1.34
Cairo version: 1.17.6
Pango version: 1.44.7
HarfBuzz version: 2.6.4
OS version: Debian GNU/Linux 11 (bullseye)