How to convert a JPEG image into SVG format using ImageMagick?

前端 未结 3 1102
南旧
南旧 2021-01-30 10:52

How to convert a JPEG image into SVG format using ImageMagick?

3条回答
  •  面向向阳花
    2021-01-30 11:42

    Actually, with a complete installation of a recent version of ImageMagick it should be as easy as:

    convert  some.jpeg  some.svg
    

    Of course, ImageMagick cannot do it all by itself -- it uses delegates (helper programs) to handle SVG input or output. (This has been pointed out by other answers already.)

    To see a (partial) list of all delegates (and their respective commands), run

    convert  -list delegate
    

    To see the config file where all the delegate secrets hide, see

    convert  -list delegate | grep delegates.xml
    

    To see a (partial) list of SVG handling delegates, run

    convert  -list delegate | grep -i svg
    

    However, ImageMagick likes to put some of its external helper utilities into 'stealth' mode and doesn't necessarily reveal their presence when using above commands.

    Just look into the delegates.xml file itself. On my system it's:

    grep -i svg /opt/local/etc/ImageMagick/delegates.xml | grep -i --color stealth
    
      
    
      
    

    As you may see, on my system the ImageMagick installation automatically uses (amongst others)...

    • ...inkscape to convert SVG to PNG;
    • ...autotrace to convert PNM to SVG;

    Of course, one could argue the benefits of rather using autotrace directly -- but that would require to manually convert the whatever-input-format to PNM first. So for this preliminary step you'd probably use ImageMagick anyway...

提交回复
热议问题