conversion error by SVG to PNG
Posted: 2007-12-17T05:38:38-07:00
Hello,
I have a usage questions which are too arcane for the normal user list. Hence I post in this section. In my point of view, convert.exe has a bug in the coordinate system for transform vector graphic to pixel graphic. But maybe the developer see this differently. For a normal user the behaviour is not relevant.
I want a SVG (vector graphic) image convert to a PNG (pixel graphic) image. In the SVG image the unit is always px (pixel). The output to the PNG image must be 1:1 without antialias:
convert.exe +antialias input.svg output.png
This produce a unexpected result. Example: A SVG rectangleshould produce a black pixel on the upper, left edge in the PNG image. But the result is a 2x2 pixel rectangle. The reason is, that the zero point of the destination coordinate system is not on the middle of the upper, left PNG image pixel. Rather it is at the right, bottom edge of the upper, left pixel. If I try
then it's work correct. But I can not change the input image at the real application, so I need a bug fix or work around for a correct output.
I have try to use
convert.exe +antialias input.svg -distort SRT '0,0 1 0 -0.5, -0.5' output.png
This bring the error message: unrecognized option `-distort'. I use imagemagick 6.3.4-q8 (Windows XP binary). Why this? Is distort SRT a solution for my problem or work this only from pixel image to pixel image?
If no user solution available, I would be happy, if some developer can help me, to make a source code patch.
Many thanks in advance
Bernd
I have a usage questions which are too arcane for the normal user list. Hence I post in this section. In my point of view, convert.exe has a bug in the coordinate system for transform vector graphic to pixel graphic. But maybe the developer see this differently. For a normal user the behaviour is not relevant.
I want a SVG (vector graphic) image convert to a PNG (pixel graphic) image. In the SVG image the unit is always px (pixel). The output to the PNG image must be 1:1 without antialias:
convert.exe +antialias input.svg output.png
This produce a unexpected result. Example: A SVG rectangle
Code: Select all
<rect
x="0"
y="0"
width="1"
height="1"
style="fill:#000000;fill-opacity:1;stroke:none;
id="rect2170"
/>
Code: Select all
<rect
x="-0.5"
y="-0.5"
width="1"
height="1"
style="fill:#000000;fill-opacity:1;stroke:none;
id="rect2170"
/>
I have try to use
convert.exe +antialias input.svg -distort SRT '0,0 1 0 -0.5, -0.5' output.png
This bring the error message: unrecognized option `-distort'. I use imagemagick 6.3.4-q8 (Windows XP binary). Why this? Is distort SRT a solution for my problem or work this only from pixel image to pixel image?
If no user solution available, I would be happy, if some developer can help me, to make a source code patch.
Many thanks in advance
Bernd