Steps to reproduce:
1) convert someimage.png output.svg
or
2) convert somepdf.pdf output.svg
where the pdf contains embedded images.
Expected: the image/s should be embedded in the svg in the form <image xlink:href="data:image/png;base64,iVBORw0KGgo........" etc>
Observed: every pixel of the image is converted into a circle of 1px diameter. EVEN in the case of the pdf. if the images are not very tiny, you end up with a gigantic svg file.
Compare this to the behavior of Inkscape: if you import an image into inkscape and save as svg, the image is embedded as expected. And if you import a pdf into inkscape and save as svg, too.
Breaking the image into per-pixel 1-px circles may be an interesting possibility to have available as an option, but it shouldn't be the default behavior, it's insane in most cases.
Images embedded in svg are broken into une circle per pixell
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Images embedded in svg are broken into une circle per pi
Imagemagick is not a good tool to use for vector processing. It is a raster tool. It will not vectorize a raster image properly. You need to find some other tool for that. see http://www.imagemagick.org/Usage/formats/#vector
Re: Images embedded in svg are broken into une circle per pi
Then why does it support svg and pdf formats?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Images embedded in svg are broken into une circle per pi
teo8976 wrote:Then why does it support svg and pdf formats?
Mostly to convert them to raster formats. I do not think that IM supports embedding the raster image directly into an svg shell at this time.
Re: Images embedded in svg are broken into une circle per pi
We'll get a patch in ImageMagick 6.8.9-4 to create the SVG with an inline image. Thanks for the suggestion.
Re: Images embedded in svg are broken into une circle per pi
Ok, I've now read the note that explains that imagemagick rasters everything forth and back, so I'm simply using the wrong tool anyway (I wrongly thought vectors would be maintained in vector-vector conversions - I seemed to remember I had used IM before for such tasks, I was confused, I must have used something else). Sorry.
Inline images would be an improvement, however. In those cases where one just needs a quick hack to get a given output format (e.g. svg or pdf) and doesn't care very much about the loss of information implicit in rasterizing everything in the process, that will make the difference between ending up with a manageable file of a reasonable size or an unmanageable GB file.
Inline images would be an improvement, however. In those cases where one just needs a quick hack to get a given output format (e.g. svg or pdf) and doesn't care very much about the loss of information implicit in rasterizing everything in the process, that will make the difference between ending up with a manageable file of a reasonable size or an unmanageable GB file.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Images embedded in svg are broken into une circle per pi
Autotrace or Potrace can vectorize images. I believe if autotrace is installed, IM can use it. Though I believe only for b/w images. see http://www.imagemagick.org/Usage/draw/#svg_output