Page 1 of 1
SVG files created with IM are not rendered in browsers
Posted: 2011-11-29T03:22:44-07:00
by gialloporpora
Hi all,
I have a question about conversion of PNG files to SVG with ImageMagick.
I'am using ImageMagick 6.7.3-8 q16 for Win32 to convert some PNG to SVG format:
I convert my PNG file with ImageMagick:
Code: Select all
convert input.png output.svg
convert input.png output.svgz (compressed version)
Now, if I try to open it them with Firefox (or another browser like Opera) it opens the SVG like an XML file with missing stylesheet:
Resulting SVG created with ImageMagick
Instead, if I use Inkscape to convert my PNG file it works:
SVG created with Inkscape
Why the image converted with ImageMagick is not displayed by browsers?
Re: SVG files created with IM are not rendered in browsers
Posted: 2011-11-30T20:09:40-07:00
by anthony
I can confirm that this appears to be the case. Though I am not certain why.
Mind you, converting a raster image directly to SVG using IM is NOT recommended as it basically generates a large file of small dots, unless you enable the use of the rasterization library "autotrace" when compiling Imagemagick.
See IM Examples... SVG Output Handling
http://www.imagemagick.org/Usage/draw/#svg_output
And Edging using a Raster to Vector Converter
http://www.imagemagick.org/Usage/transform/#edge_vector
The Mime type of both image examples provided are both
image/svg+xml so that does not appear to be the problem with the browsers internal SVG handling.
however even rsvg-view is not handling the SVG file generated, so something is VERY wrong!
Definate bug.
Re: SVG files created with IM are not rendered in browsers
Posted: 2011-12-01T05:02:10-07:00
by magick
rsvg-view, version 2.34.2, worked for us for both the ff64im.svg and for this command:
We suspect the large number of circles is taxing some of the SVG rendering engines.
Re: SVG files created with IM are not rendered in browsers
Posted: 2011-12-02T17:15:14-07:00
by gialloporpora
Thanks Anthony and Magick for your reply
In fact, I have never used SVG before, but I am curious to learn more about this argument.
I have seen that the Inkscape image is not a real SVG image, it is only a PNG (in data link format) embedded in the resulting XML file.
Thanks for your answer to my question
Sandro
Re: SVG files created with IM are not rendered in browsers
Posted: 2011-12-04T18:31:55-07:00
by anthony
Can you provide use an example of that PNG embedded in a SVG?
This would be a much better solution for general conversion of images to SVG.
The other method that IM can provide is by compiling IM with a autotrace delegate library. In that case IM will use that library to generate vector forms of SVG, especially for black and white images.