Inkscape does not render image according to standard

Asked by David D Berger on 2012-07-23

I am opening SVG files that have image {xlink:href="filename.jpeg" ........} and no preserveAspectRatio setting.

The preserveAspectratio should default to preserveAspectRatio="xMidYMid", however it appears the it is defaulting to "none"

All my SVG files tested so far open fine in FF, IE9 and default setting is correct in those browsers.

Therefore, the files appear differently (wrong) in Inkscape.

Can this be addressed? I would ask this be set at a very high priority, since anyone using Inkscape for browser pages will have this issue.


Here is the link to W3 standard:

Also, there are no viewbox settings in the files. Here is an example:

 <image xlink:href="uploads/20120719235108.jpeg" id="svg_38" height="262.133915" width="292.650251" y="-4.195235" x="911.395745" />

su_v (suv-lp) said : #2

Known issue, already filed multiple times in the bug tracker:

Bug #461467 in Inkscape: “Image scale saved incorrectly”

Bug #616717 “Resized bitmap images are rendered differently by Firefox or Batik ('preserveAspectRatio' attribute not set)”

Bug #924377 “wrong default value for image preserveAspectRatio”

su_v (suv-lp) said : #3

> Also, there are no viewbox settings in the files. Here is an example:

Which viewBox are you referring to here? Using one with the top-level <svg> attribute is not mandated by SVG 11 AFAIU, nor is it a valid attribute of <image> elements themselves nor does the SVG spec require linked bitmap images to be wrapped into container element with a viewBox attribute set (the <image> element establishes its own viewport, and has an implicit viewBox).

To quote from the section you link to:
«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.»

And from the section about the <image> element:
«An ‘image’ element establishes a new viewport for the referenced file as described in Establishing a new viewport. The bounds for the new viewport are defined by attributes ‘x’, ‘y’, ‘width’ and ‘height’. The placement and scaling of the referenced image are controlled by the ‘preserveAspectRatio’ attribute on the ‘image’ element.
The value of the ‘viewBox’ attribute to use when evaluating the ‘preserveAspectRatio’ attribute is defined by the referenced content. (…) For most raster content (PNG, JPEG) the bounds of the image should be used (i.e. the ‘image’ element has an implicit ‘viewBox’ of '0 0 raster-image-width raster-image-height'

Thanks - I had not seen bug#924377, which is identical problem and is somewhat related to the other bugs you mentioned. Here is quote regarding default settings. These settings are used in major browsers as well as CS5:

xMidYMid (the default) - 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.

**my test SVG files did not have viewbox setting which is not required. That is correct. viewbox,viewport are defined by referenced content.

 bug#924377 should be escalated & assigned since every image loaded is likely affected/distorted.

Let me know if I can help.

Can you help with this problem?

Provide an answer of your own, or ask David D Berger for more information if necessary.

To post a message you must log in.