SVG Order of Transformations Regression
Posted: 2010-11-21T02:47:23-07:00
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
translate-scale.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
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>
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>
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>