I have successfully converted a PNG to an SVG using the following command:
convert Slide3.png Slide3_converted.svg
The problem is the resulting file is a whopping 380MB!
I tried this version of the command:
convert -size 2000x1200 Slide3.png Slide3_converted_smaller.svg
But no dice. Same size.
SVG is a vector image format, so converting a raster image (jpg, png, gif etc.) to svg can be a complex task.
I tried to convert a simple image: white background with a red circle and a blue square using:
convert input.png output.svg
here's a sample from the svg file created by this command:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="800" height="600">
<circle cx="0" cy="0" r="1" fill="white"/>
<circle cx="1" cy="0" r="1" fill="white"/>
...
<circle cx="218" cy="151" r="1" fill="rgb(255,247,247)"/>
<circle cx="219" cy="151" r="1" fill="rgb(255,40,40)"/>
<circle cx="220" cy="151" r="1" fill="red"/>
<circle cx="221" cy="151" r="1" fill="rgb(255,127,127)"/>
<circle cx="222" cy="151" r="1" fill="white"/>
<circle cx="223" cy="151" r="1" fill="white"/>
...
<circle cx="799" cy="599" r="1" fill="white"/>
</svg>
basically ImageMagick created a 1px radius circle for each pixel, painting it in the correct color. Starting from a 5KB png my output was a 22MB svg, this explains the huge file size you obtained.
According to ImageMagick documentation (see here) this happens because "AutoTrace" (see here) library is missing:
"If the "AutoTrace" library is not installed and compiled into IM, then the SVG output generated will be a huge number of single pixel circles, generating a binary result, rather than a smooth SVG outlined image. Such images are huge by comparision, and often take a very long time to render by by SVG render."
once you have installed AutoTrace library you can try with something like this:
convert autotrace:A.gif A_traced.png
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With