Page 1 of 1

SVG Order of Transformations Regression

Posted: 2010-11-21T02:47:23-07:00
by infix-logic
Sometime between ImageMagick versions 6.6.1-0 2010-04-18 and 6.6.5-0 2010-11-21 the order that SVG transformations are handled in has changed.

I have two SVG files:

scale-translate.svg

Code: Select all

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="100" height="100" version="1.1" xmlns="http://www.w3.org/2000/svg">
   <g transform="scale(10, -10) translate(0 100)">
    <polygon points="0 0,0 10,5 5,10 10, 8 6,10 0,3 3,0 0" fill="#000"/>
  </g>
</svg>
translate-scale.svg

Code: Select all

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="100" height="100" version="1.1" xmlns="http://www.w3.org/2000/svg">
   <g transform="translate(0 100) scale(10, -10)">
    <polygon points="0 0,0 10,5 5,10 10, 8 6,10 0,3 3,0 0" fill="#000"/>
  </g>
</svg>
I am attempting to convert from SVG to PNG with:

convert file.svg file.png

For translate-scale.svg, 6.6.1 gives an image with the polygon flipped, scaled by 10, and taking up the full viewport (desired). 6.6.5 gives an blank image (I assume the polygon is outside the viewport).

For scale-translate.svg 6.6.5 gives the desired image and 6.6.1 gives the blank image. The only difference between these files is that the order of the transformations are reversed.

I've looked at both SVG files in Firefox (4b7) and Safari (5.0.3) and both browsers gives the same results as ImageMagick 6.6.1. As far as I can tell from reading the spec 6.6.1 is correct.

For no-translate.svg (below), both 6.6.1 and 6.6.5 produce the same results.

Which version of ImageMagick is correct? Is the output in 6.6.5 correct or is it a bug?

no-translate.svg

Code: Select all

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="100" height="100" version="1.1" xmlns="http://www.w3.org/2000/svg">
  <polygon points="0 0,0 10,5 5,10 10, 8 6,10 0,3 3,0 0" fill="#000"/>
</svg>

Re: SVG Order of Transformations Regression

Posted: 2010-11-21T07:30:47-07:00
by magick
We're using Firefox 3.6 and scale-translate.svg renders a blank page. The rsvg command-line program also produces a blank canvas. However, the internal ImageMagick renderer produces the image you expect: convert msvg:scale-translate.svg scale-translate.png.

Re: SVG Order of Transformations Regression

Posted: 2010-11-21T19:57:47-07:00
by infix-logic
Thanks for the quick reply. I'm not sure I understand your response.

I've tested the images in Firefox 3.6.12 and it returns the desired image for translate-scale.svg while scale-translate.svg is blank (the same results as you get, which is good). This is the results I expect.

translate-scale.svg is correct. scale-trasnlate.svg is wrong.

I've also tried adding msvg: to the convert command, however it did not change the results I got with either ImageMagick 6.6.1 or 6.6.5. 6.6.1 produces the desired image when given translate-scale.svg, 6.6.5 does not.

Assuming Firfox 3.6 is correct ImageMagick 6.6.1 is correct and 6.6.5 is wrong.

So, is Firefox 3.6 correct? Is ImageMagick 6.6.5 wrong?