Page 1 of 1

SVG image preserveAspectRatio support or work-around

Posted: 2010-06-10T16:03:04-07:00
by neilo
I have a small SVG file which defines how to create a thumbnail from an arbitrary image (I use XSL to fill in the filename) and then I planned on using the command-line convert utility (ImageMagick) against this to make it a JPG. The SVG views fine in FireFox but the JPEG created by ImageMagick appears to disregard preserveAspectRatio in svg:image.

Here is my SVG, you can try it with any ol' source image:

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="125" height="125" version="1.1"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink">
	<image xlink:href="full-size-image.jpg" x="0" y="0"
		width="125" height="125" preserveAspectRatio="xMidYMin slice" />
	<rect x="0" y="0" width="125" height="125" rx="4" ry="4"
		stroke="white" stroke-width="3" fill="none" />
</svg>
Is there no support for this in ImageMagick, or it's perhaps a bug or in the works? I wasn't sure where to post this particular issue, so maybe it belongs in the developer forum. Any wizards out there have suggestions or work-arounds?

Thanks in advance!

Re: SVG image preserveAspectRatio support or work-around

Posted: 2010-06-10T16:47:39-07:00
by magick
Type
  • identify -list format
and make sure RSVG is associated with the SVG tag. We converted your SVG script with ImageMagick-6.6.2-4 and it produced the expected results.

Re: SVG image preserveAspectRatio support or work-around

Posted: 2010-06-10T18:43:30-07:00
by fmw42
Do you have rsvg delegate library installed? type

convert -list configure

and look at the line DELEGATES and see if rsvg is listed. If not, then you need to install that and then reinstall IM from source.