Export layers to multiple files

Post questions on how to use or achieve an effect in Inkscape.
trevva
Posts: 2
Joined: Thu May 26, 2011 7:06 pm

Export layers to multiple files

Postby trevva » Thu May 26, 2011 7:18 pm

Hi,

I am using Inkscape to generate a basic animation to explain how a scientific model works. I have built my file up on the basis of layers, so that I can introduce the various elements individually. I would now like to export the file (e.g. pdf, jpg), so that I can incorporate it into LaTeX or Powerpoint or whatever. Ideally, I would like to export each layer either 1) as a separate file ie Mdl001.jpg, Mdl002.jpg, Mdl003.jpg or 2) as individual pages of a single pdf. Unfortunately, I can't seem to figure out how to do this.

Can anyone please point me in the right direction?

Thanks

Mark

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Export layers to multiple files

Postby brynn » Thu May 26, 2011 10:22 pm

Hi Mark,
Image
Welcome to the forum!

I'm not positive about this, but I think it might be something close to what you're looking for. File menu > Export Bitmap. In the dialog, there is a checkbox "Batch export selected objects". I think this will export each individual object to separate PNG files. And I realize it's not exactly what you're hoping for, but it's the closest thing I know of. Others may know more....

I'm not sure about JPGs or PDF.

I was investigating a simple animation (my avatar) a while back, and learned that The GIMP can import each Inkscape batch exported PNG as a layer, and then treats each GIMP layer as an animation "frame".

Also, you might try searching the forums here. There have been discussed some other approaches to animating SVGs. I just can't remember the details at the moment.

I wish I could be more helpful.

trevva
Posts: 2
Joined: Thu May 26, 2011 7:06 pm

Re: Export layers to multiple files

Postby trevva » Thu May 26, 2011 10:35 pm

Thanks for the kind welcome - I've not experienced that on a forum before! :-)

I've had a good look through the forums and googled extensively, but not found much that was particularly useful unfortunately.

The "Batch export selected objects" is the right type of functionality, but its clearly designed with something else in mind - what you end up with is a collection of png files corresponding to the individual objects, rather than anything that could be easily imported into eg LaTeX.... There is unfortunately no way to control export format or the area that is covered - its a fully automatic tool. But you would think that it might not be that hard to modify to work on layers, for example...

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Export layers to multiple files

Postby brynn » Sun May 29, 2011 5:46 pm

Hhhhm, well this may not be any more helpful than my previous comments. But I was just thinking that Inkscape layers are not really layers, like are used in other graphics programs. If I recall, it's because there's no SVG standard for layers (yet). So layers in Inkscape are implemented by special Groups.

I don't think that helps get you any closer to your goal. At least not any time soon. But the reason it's called "Export Bitmap" and not "Export PNG" is because future plans call for adding other raster formats (and I hope the proper language, i.e. - "raster" instead of "bitmap") to that dialog and functionality, I would assume including JPG. So someday it will be possible.

But for now, all I can recommend is batch exporting to PNG, and opening each individual PNG in The GIMP as a layer. Or save each layer as PDF. Or you might have found a reference to Synfig in your searches? If not, this is an interesting animation program (although fairly "young" in its development): http://synfig.org/cms/.

Again, sorry I couldn't find your solution :(

berteh2
Posts: 5
Joined: Fri Apr 19, 2013 6:39 pm

Re: Export layers to multiple files

Postby berteh2 » Tue Mar 18, 2014 7:07 pm

Hello.

The following script allows for batch export (from command line) a set of objects using inkscape, each to its own file. https://github.com/berteh/svg-objects-export
Any option from synfig's command line can be passed to the script. Objects to export can be identified by some regular expression on the id, or using xpath.

To export each layer in its file I'd make all layers visible at the same time, save and execute the following:

Code: Select all

./svg-objects-export.py --xpath "//svg:g[@inkscape:groupmode='layer']" --extra '--export-area-page --export-id-only' my-image.svg


See other options of script at https://github.com/berteh/svg-objects-export.

PDF and a few other export are readily supported via inkscape. Turning the png into jpg is a matter of

Code: Select all

mogrigy -format jpg *.png
using imagemagick (http://www.imagemagick.org/)
Hope this helps.
Berteh2.

User avatar
Maestral
Posts: 982
Joined: Sat Aug 27, 2011 7:10 am

Re: Export layers to multiple files

Postby Maestral » Sat Aug 09, 2014 2:08 am

Hi berteh2,

I`m looking for a way to batch export objects as .svg`s so I tried to do it with your script, but I couldn`t find a proper arguments to succeed with export. Any suggestions?

Win7 x64 / 0.48.5 r10040
:tool_zoom: <<< click! - but, those with a cheaper tickets should go this way >>> :!:

2late2reply
Posts: 1
Joined: Thu Aug 06, 2015 2:22 pm

Re: Export layers to multiple files

Postby 2late2reply » Thu Aug 06, 2015 2:50 pm

Oh my gosh I'm late to this, but I've decided to post an answer so that anyone who felt my pain in trying to find one does not have to learn this on their own.
Note, the white background of the face has been changed to blue for the sake of visibility.

The Batch Export option you are given when choosing Export To Bitmap is exactly what you need, however there is a catch; you must separate each object into its own, non-conflicting, non-overlapping area within Incscape. It should look something like this:

Image

Once your objects have been separated, marquee select them all with the Selector. They do not need to be inside the page, as they are exported based upon the content of the object, not the position of it.

Image

Export To Bitmap, select your file location, and make sure to check Batch Export.

Image

Once this has been done, you should have as many bitmap files in the specified directory as there were selection boxes visible. What this also means is that if two objects overlap, you will see anything that is inside that objects selection box in its exported file. Just make sure that none of the selection boxes overlap each other, and each file exported should consist only of its object.

Image

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Export layers to multiple files

Postby brynn » Fri Aug 07, 2015 3:05 am

You must not have read closely the whole topic. The op clearly indicated that batch export is not what he wanted.

trevva wrote:Thanks for the kind welcome - I've not experienced that on a forum before! :-)

I've had a good look through the forums and googled extensively, but not found much that was particularly useful unfortunately.

The "Batch export selected objects" is the right type of functionality, but its clearly designed with something else in mind - what you end up with is a collection of png files corresponding to the individual objects, rather than anything that could be easily imported into eg LaTeX.... There is unfortunately no way to control export format or the area that is covered - its a fully automatic tool. But you would think that it might not be that hard to modify to work on layers, for example...

Inkjames
Posts: 1
Joined: Thu Dec 01, 2016 4:12 am

Re: Export layers to multiple files

Postby Inkjames » Thu Dec 01, 2016 4:16 am

I am not sure if this is still an issue, but I wrote a very basic script which produces a new SVG file for each layer within an inkscape document. I find it useful for producing sub-figures of the same size. https://github.com/james-bird/layer-to-svg

User avatar
prkos
Posts: 1625
Joined: Tue Nov 06, 2007 8:45 am
Location: Croatia

Re: Export layers to multiple files

Postby prkos » Sun Dec 04, 2016 8:01 am

Thank you Inkjames! I can think of some cases where this can come in very useful!

BTW you have a small typo in README: svd
just hand over the chocolate and nobody gets hurt

Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download

ShawnWDion
Posts: 70
Joined: Fri Apr 22, 2016 8:32 am

Re: Export layers to multiple files

Postby ShawnWDion » Sun Dec 04, 2016 2:19 pm

http://svgsplit.com/

You can get the offline version from github does exactly what you want to do.

ShawnWDion

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Export layers to multiple files

Postby tylerdurden » Mon Dec 05, 2016 1:39 am

Seems like that could be a nice extension.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

User avatar
fillotassi
Posts: 19
Joined: Wed Sep 06, 2017 11:47 pm
Location: Italy
Contact:

Re: Export layers to multiple files

Postby fillotassi » Wed Sep 20, 2017 10:34 pm

Inkjames wrote:I am not sure if this is still an issue, but I wrote a very basic script which produces a new SVG file for each layer within an inkscape document. I find it useful for producing sub-figures of the same size. https://github.com/james-bird/layer-to-svg


Hello Inkjames!

I would like to use your script, should I put it somewhere inside Inkscape? Or should I use it from Terminal?

Thanks!

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Export layers to multiple files

Postby brynn » Fri Sep 22, 2017 3:20 pm

I can't give you an answer about that. But I did find this extension: https://github.com/fluffware/export_layer_combinations If it exports layer combinations, I would guess that it could export one at a time. But you'd just have to test, to find out.


Return to “Help with using Inkscape”