Image scale saved incorrectly (preserveAspectRatio)

Bug #461467 reported by Artfunkel
30
This bug affects 7 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
High
Tavmjong Bah

Bug Description

I added an image to my SVG by dragging it in from Explorer. I scaled it down, at first uniformly then a little bit of non-uniform, until it fitted within a frame element I had created.

Everything looked fine in Inkscape, but when I opened the saved file in Firefox or GIMP the image was a different size and did not fit in the frame (see attachment).

This is Inkscape 0.47pre4-1 on Win Vista 32.

Revision history for this message
Artfunkel (t-edwards) wrote :
su_v (suv-lp)
tags: added: bitmap transformations
Revision history for this message
su_v (suv-lp) wrote :

1) Could you attach the original SVG file (or a reduced testcase) + the linked bitmap?
2) What happens if you embed the image (Extensions > Images > Embed Images…')?

… and just to avoid any misunderstanding: this is not a bug with exported PDFs or bitmaps but a difference in rendering compared to other SVG libraries used by GIMP and Firefox?

Revision history for this message
Artfunkel (t-edwards) wrote :

I've turned the image link into an HTTP one for the purposes of upload, but it doesn't change the behaviour. Embedding the images does nothing either.

Raster/PDF export works as expected.

Revision history for this message
su_v (suv-lp) wrote :

Confirmed with Inkscape 0.46+devel r22540 on OS X 10.5.8

x-scale of the rendered bitmap seems off (too small) compared to other SVG viewers (Firefox 3.5.3, Batik 1.7)

Changed in inkscape:
status: New → Confirmed
Revision history for this message
su_v (suv-lp) wrote :

s/too small/to big/

Revision history for this message
su_v (suv-lp) wrote :

Even after snapping the bitmap bbox to the corner nodes of the stroked rectangle forming the picture frame, other viewers render the the width of the scaled image smaller (Firefox: on both left and right sides a vertical gap between image and stroke of 7px + 5px half-stroke-width).

Revision history for this message
su_v (suv-lp) wrote : Re: [Bug 461467] Re: Image scale saved incorrectly

After creating a sample testcase the difference I see is so obvious that
this must be either a known limitation of the SVG specification itself
or an enhanced feature of Inkscape not supported by other SVG viewers:
none of the not-uniform transformations (e.g. scaling by dragging the
selection handles) of linked or embedded bitmap images are rendered in
other SVG viewers (like Batik 1.7 or Firefox 3.5.3). Will search for
related bug reports...

Revision history for this message
su_v (suv-lp) wrote :

Re-doing previous testcase with the preference 'Transforms > Store
transformations [x] Preserved' results in identically scaled linked or
embedded images in Inkscape and the two compared SVG viewers (Batik 1.7
and Inkscape 3.5.3).

Can someone comment how to triage this bug - 'Confirmed' or 'Invalid'?

Revision history for this message
su_v (suv-lp) wrote : Re: Image scale saved incorrectly

JFTR - the wishlist report that gave me the first clue to compare 'Optimized' vs 'Preserved' transform options: bug #371297 “Feature request: Do not optimize transforms on Image objects”

Revision history for this message
su_v (suv-lp) wrote :

related:
Bug #616717 “SVG with embedded images are not readable by Firefox or Baltik”:

Adding 'preserveAspectRatio="none"' to a (scaled) images solves the differences in rendering between Inkscape and other SVG viewers.

Changed in inkscape:
importance: Undecided → Medium
Revision history for this message
su_v (suv-lp) wrote :

Setting bug importance to 'High' in accordance with
<http://wiki.inkscape.org/wiki/index.php/Bug_management#Bug_importance>:
"non-SVG-compliant output"

Changed in inkscape:
importance: Medium → High
tags: added: svg
jazzynico (jazzynico)
summary: - Image scale saved incorrectly
+ Image scale saved incorrectly (preserveAspectRatio)
Revision history for this message
su_v (suv-lp) wrote :
Changed in inkscape:
assignee: nobody → Tavmjong Bah (tavmjong-free)
milestone: none → 0.91
status: Confirmed → Fix Committed
Revision history for this message
Magnes (magnesus2) wrote :

My old files are now opened with wrongly scaled images (since they don't have preserveAspectRatio). :(
Maybe inkscape could detect Inkscape generated files and automaticaly add preserveAspectRatio=none? Or give user an option to automaticaly add that? Because right now I have hundreds of SVG files which are read improperly by Inkscape. :(

Revision history for this message
Cosmo Guffa (cosmo-guffa) wrote :

Yes, I had a problem with image scaling in r1379 too and adding the preserveAspectRatio=none fixed them. There are so many great features in the trunk that I want/need so I hope you will take @Manges suggestions soon

Changed in inkscape:
status: Fix Committed → Confirmed
Revision history for this message
su_v (suv-lp) wrote :

On 2014-12-10 21:25 (+0100), Cosmo Guffa wrote:
> There are so many great features in the trunk that I want/need so I
> hope you will take @Manges suggestions soon

Tracked in a separate report:
- Bug #1357808 “trunk: add extension to fix rendering of non-uniformly scaled bitmap images”
  <https://bugs.launchpad.net/inkscape/+bug/1357808>

Changed in inkscape:
status: Confirmed → Fix Committed
Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.