Split the layers of an SVG into individual PNG files?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Jduke
Posts: 2
Joined: 2014-02-12T10:09:13-07:00
Authentication code: 6789

Split the layers of an SVG into individual PNG files?

Post by Jduke »

Hi all;

Is there a way to split out the layers of my SVG file into multiple .PNG files?

Thanks in advance!

JDuke
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Split the layers of an SVG into individual PNG files?

Post by snibgo »

Yes, with a text editor. Ideally one that understand XML syntax.
snibgo's IM pages: im.snibgo.com
Jduke
Posts: 2
Joined: 2014-02-12T10:09:13-07:00
Authentication code: 6789

Re: Split the layers of an SVG into individual PNG files?

Post by Jduke »

Is there a way to do this using ImageMagick? Or any other tool?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Split the layers of an SVG into individual PNG files?

Post by snibgo »

It depends on exactly what you want to do. IM can create a PNG from an SVG, but you would want to split out the different layers first. For a one-off job, Inkscape or an interactive text editor are the obvious choices. If you have many SVG files to process, a script could do the job, with sed or similar. If I was doing it, I might write a custom program using my XML library.

ImageMagick can rasterise the SVG (convert it to pixels). Depending on the SVG, maybe the layers correspond to channels or something, but probably not.

If you have a sample file and it is quite small, you can paste the contents here between [ code ] and [ /code] tags. If it is large, you can put it somewhere like dropbox.com and paste the URL here.
snibgo's IM pages: im.snibgo.com
Post Reply