Page 1 of 1

Convert any image to vector graphic ?

Posted: 2013-08-11T13:40:25-07:00
by Rye
Since I got some images I'd like to try and convert to vector images I'll just right out ask:

Is it possible to have Imagemagick create vector images from multiple lets say png's I have ?

Thanks for an answer in advance.

Re: Convert any image to vector graphic ?

Posted: 2013-08-11T14:04:27-07:00
by snibgo
Sorry, no. IM can convert from vector to raster, but not raster to vector.

Inkscape can do this ("trace bitmap"), and other tools are available.

Re: Convert any image to vector graphic ?

Posted: 2013-08-11T14:08:35-07:00
by Rye
Can Inkscape batchprocess images ?

Re: Convert any image to vector graphic ?

Posted: 2013-08-11T14:22:40-07:00
by snibgo
To some degree, though it is really an interactive program. I don't know if it can trace bitmaps in batch. Potrace (http://potrace.sourceforge.net/) may be better for you.

Re: Convert any image to vector graphic ?

Posted: 2013-08-11T14:40:05-07:00
by fmw42

Re: Convert any image to vector graphic ?

Posted: 2013-08-11T14:48:51-07:00
by Rye
Well since Potrace obviously only converts images to black and white: http://potrace.sourceforge.net/mkbitmap.html

I shall try that even if it means I have to use my linux environment.

Re: Convert any image to vector graphic ?

Posted: 2013-08-11T15:21:27-07:00
by snibgo
Potrace just finds edges and makes paths. You can use IM to do colour-separation first, then edit the SVG output from Potrace as appropriate.

If you supply a sample image and what you are trying to do with it, advice can be more specific.

Re: Convert any image to vector graphic ?

Posted: 2013-08-11T16:33:04-07:00
by Rye
According to this http://stackoverflow.com/questions/1132 ... magemagick Imagemagick can do it with autotrace etc. as support app ?

Image to test:

Image

Re: Convert any image to vector graphic ?

Posted: 2013-08-11T17:16:40-07:00
by snibgo
And what vectors do you want? If you want a load of small circles, negate the image first (eg with potrace "-i" or IM "-negate"). In potrace, you'll want "-t 0" to capture even the smallest stars. You'll probably also want to play with -k, --fillcolor and others. See potrace documentation.

Re: Convert any image to vector graphic ?

Posted: 2013-08-11T17:27:05-07:00
by Rye
However I need a colored vector image.

Can Potrace do this ?

Re: Convert any image to vector graphic ?

Posted: 2013-08-11T17:32:40-07:00
by fmw42
I do not think a raster image can be effectively vectorized? You will get millions of vectors if not a fault because there are too many. You probably cannot vectorize such a raster image, only ones with a few constant color regions. But I will defer to those others who know more about vectorizing.

Re: Convert any image to vector graphic ?

Posted: 2013-08-11T17:46:05-07:00
by snibgo
Potrace won't decide on the colours for the vectors.

Re: Convert any image to vector graphic ?

Posted: 2013-09-29T19:34:40-07:00
by anthony
The only effective vectorisation tool I have seen for colored images involves using vector data that is not available generally to vector images.

One example was a IFS (fractal generator) method that was never made public (tried to be commercial).
You example image for example would compress extremely well using a IFS image format, as it has a lot of fractal like information in it.

Another is the use of Diffusion Curves. which defines colors along edges, and then generated gradients from those colors.
http://maverick.inria.fr/Publications/2 ... /index.php

But no generally color images do not vectorise easilly, at least not without a lot of simplification, and color distortions.