Inkscape: A Vector Drawing Tool

Resized bitmap images are rendered differently by Firefox or Batik ('preserveAspectRatio' attribute not set)

Reported by Igor Lino on 2010-08-12
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Inkscape
High
Tavmjong Bah

Bug Description

Technical details of solution at:
https://bugzilla.mozilla.org/show_bug.cgi?id=586433

extra explanation:
https://issues.apache.org/bugzilla/show_bug.cgi?id=39561

I have generated a couple of SVG that have embedded images with Inkscape
but after opening or files in firefox, I get everything perfectly rendered
except the images.

Reproducible: Always

Steps to Reproduce:
1.Print/Export any website with background images enabled to a PDF (i.e. using
FreePDFXP)
2.Import the PDF into Inkscape (embedding images)
3.Save the image in SVG format.
4.Open the SVG file in Firefox.
Actual Results:
After opening or files in firefox, I get everything perfectly rendered except
the images which look compressed. The files open fine in Inkscape.

Expected Results:
The embedded images in SVG should render fully as in the original WebSite/PDF.

~suv (suv-lp) on 2010-08-12
tags: added: importing pdf
~suv (suv-lp) wrote :

Reproduced with Inkscape 0.48+devel r9701 on OS X 10.5.8 (poppler 0.12.4, cairo 1.8.10)

An imported PDF with embedded images and saved as SVG file only renders as expected in Inkscape, but looks different with regard to the scaling of the embedded bitmap from other renderers (e.g. Firefox 3.6.8, Safari 5.0, Opera 10.60 and Squiggle (Batik 1.7)).

Changed in inkscape:
importance: Undecided → Medium
status: New → Confirmed
~suv (suv-lp) wrote :

from the mozilla bug report:

> Ah, and that's because the meaning of |width="1" height="1"| is that the image
> should be fit into a 1x1 rectangle. _How_ it fits in there depends on the
> value of the preserveAspectRatio attribute. The default value if the attribute
> is not specified is "xMidYMid" according to section 7.8 of the SVG 1.1
> specification. The behavior of this is defined to be:
>
> Force uniform scaling.
> Align the midpoint X value of the element's ‘viewBox’ with the midpoint X
> value of the viewport.
> Align the midpoint Y value of the element's ‘viewBox’ with the midpoint Y
> value of the viewport.
>
> If I add preserveAspectRatio="none" to the <image>, then all the browser render
> the way Inkscape does.
>
> So sounds like this is a bug in Inkscape: it's assuming an incorrect default
> value of preserveAspectRatio.

Related issue reported in:
Bug #461467 in Inkscape: “Image scale saved incorrectly”
<https://bugs.launchpad.net/inkscape/+bug/461467>

After adding 'preserveAspectRatio="none"' to each of the scaled images the SVG file renders as expected and identically in Inkscape, Firefox and Batik.

~suv (suv-lp) wrote :

Edited example from bug #461467 (attached to comment #7),
with 'preserveAspectRatio' added to each scaled image

tags: added: bitmap transformations
removed: importing pdf
~suv (suv-lp) on 2010-08-12
summary: - SVG with embedded images are not readable by Firefox or Baltik
+ Resized bitmap images are rendered differently by Firefox or Batik
+ ('preserveAspectRatio' attribute not set)
~suv (suv-lp) wrote :

from the Scalable Vector Graphics (SVG) 1.1 specification:

5.7 The ‘image’ element:
«If attribute ‘preserveAspectRatio’ is not specified, then the effect is as if a value of xMidYMid meet were specified.»
<http://www.w3.org/TR/SVG11/struct.html#ImageElement>

5.8 The ‘preserveAspectRatio’ attribute:
«For ‘image’ elements, ‘preserveAspectRatio’ indicates how referenced images should be fitted with respect to the reference rectangle and whether the aspect ratio of the referenced image should be preserved with respect to the current user coordinate system.»
<http://www.w3.org/TR/SVG11/coords.html#PreserveAspectRatioAttribute>

~suv (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
~suv (suv-lp) wrote :

Fixed for direct bitmap image import in r13020, for bitmap images of imported PDF files in r13023.

See also:
<http://thread.gmane.org/gmane.comp.graphics.inkscape.devel/42630/focus=42662>

Changed in inkscape:
assignee: nobody → Tavmjong Bah (tavmjong-free)
milestone: none → 0.91
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers