Page 1 of 1

SVG to PNG convert is offset

Posted: 2012-05-28T02:35:43-07:00
by Fibericon
I'm using ImageMagick-6.5.4.7-6.el6_2.x86_64, which is the latest package I can get with yum. The OS is Redhat 2.6.32-220.17.1.el6.x86_64. The problem I'm facing is that when I convert a SVG to a PNG or JPG, the image is offset. For instance, I'll get just the top left corner. Here are the SVG and PNG to compare:

http://cloud.ideawallets.com/testserv/a ... sketch.png
http://cloud.ideawallets.com/testserv/a ... sketch.svg

Here are the commands I attempted:

Code: Select all

convert sketch.svg sketch.png
convert -size 600X400 sketch.svg sketch.png
convert -size 600X400! sketch.svg sketch.png
convert -size 600x400 sketch.svg sketch.png
convert -resize 600x400 sketch.svg sketch.png
They all have similar results. Is it a problem on my end, or an actual bug?

Re: SVG to PNG convert is offset

Posted: 2012-05-28T09:28:15-07:00
by glennrp
The current version of ImageMagick (6.7.7-2) produces correct output. I'm not positioned to test old versions with SVG conveniently, but I guess that the +repage option might work with your version.

Re: SVG to PNG convert is offset

Posted: 2012-05-28T10:07:09-07:00
by fmw42
glennrp wrote:The current version of ImageMagick (6.7.7-2) produces correct output. I'm not positioned to test old versions with SVG conveniently, but I guess that the +repage option might work with your version.

I tried with both IM 6.7.7.2 and IM 6.7.4.10 and they both fail to show the whole image. They both show only a small portion (464x210) whether or not I add -size 640x480. +repage does nothing either.

I am on Mac OSX Snow Leopard. Using RSVG 2.34.2

This however does work correctly using the internal SVG.

convert -size 640x480 MSVG:sketch.svg sketch.png

Seems to be a bug with either RSVG or IM's use of RSVG.

Re: SVG to PNG convert is offset

Posted: 2012-05-28T19:57:56-07:00
by Fibericon
fmw42 wrote:
glennrp wrote:The current version of ImageMagick (6.7.7-2) produces correct output. I'm not positioned to test old versions with SVG conveniently, but I guess that the +repage option might work with your version.

I tried with both IM 6.7.7.2 and IM 6.7.4.10 and they both fail to show the whole image. They both show only a small portion (464x210) whether or not I add -size 640x480. +repage does nothing either.

I am on Mac OSX Snow Leopard. Using RSVG 2.34.2

This however does work correctly using the internal SVG.

convert -size 640x480 MSVG:sketch.svg sketch.png

Seems to be a bug with either RSVG or IM's use of RSVG.
Using MSVG worked perfectly. Thanks for the help.