batch exporting selections to separate svg files

Post questions on how to use or achieve an effect in Inkscape.
Inksheep
Posts: 3
Joined: Mon Oct 18, 2010 8:35 am

batch exporting selections to separate svg files

Postby Inksheep » Mon Oct 18, 2010 9:32 am

Hello everyone,

i have been searching for a way to cut a svg file in pieces and safe all the parts to separate fsvg files. I have found an extension (guillotine) that does this for PNG, but i want to export the selections to svg!
Any help?

Thanks in advance

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

Re: batch exporting selections to separate svg files

Postby prkos » Mon Oct 18, 2010 3:29 pm

Why not make copies of SVG files in your File browser then open each and delete the parts you don't want? Or cut and paste objects between files. I assume each file will contain specific objects, and not be sliced so the objects are cut in pieces like with PNG.
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

Inksheep
Posts: 3
Joined: Mon Oct 18, 2010 8:35 am

Re: batch exporting selections to separate svg files

Postby Inksheep » Thu Oct 21, 2010 1:20 am

Thanks for your reply.

well, the point is, i have made a card deck modification for a poker client, and this client stores the cards in A.svg K.svg etc. form in a folder. How do cut them from a larger file like this: Image

into smaller svgs?

sanzoghenzo
Posts: 22
Joined: Wed Dec 12, 2012 8:04 pm

Re: batch exporting selections to separate svg files

Postby sanzoghenzo » Wed Apr 17, 2013 10:39 pm

sorry to bring back this post, but I have the same issue.
I'm trying to separate url=https://github.com/mapbox/maki]mapink maki icon set[/url] (a single svg file) into multiple svgs to use with qgis.
The author uses inkscape for a batch PNG export, and every object has its id.
is there a way to do this automatically?

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: batch exporting selections to separate svg files

Postby ragstian » Thu Apr 18, 2013 12:14 am

Hi sanzoghenzo

In your case you can use the Guillotine extension for this as you want PNG files - The OP (Original Poster) wanted exports as SVG.
Place guides spaced evenly ;

Image

Use; Extensions - Export - Guillotine.
Your Images will be saved as PNG files.

Good luck.
RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

sanzoghenzo
Posts: 22
Joined: Wed Dec 12, 2012 8:04 pm

Re: batch exporting selections to separate svg files

Postby sanzoghenzo » Thu Apr 18, 2013 12:48 am

sorry, what I wanted to say is that the author of the svg uses the png export, but I wanted to save as SVG.
for now I solved by manually ctrl+c,crtl+n,crtl+v,ctrl+w like 80 times :)
I wonder if there's an automated way to do that, if I'll ever have to use it on a huge svg...

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: batch exporting selections to separate svg files

Postby ragstian » Thu Apr 18, 2013 2:16 am

Hi.

for now I solved by manually ctrl+c,crtl+n,crtl+v,ctrl+w like 80 times :)

Sounds tedious!
Sorry for misunderstanding your question. (Too early in the morning!)

To get individual svg saved I reckon you would have to go the scripting route, take a look at this page;
http://www.hoboes.com/Mimsy/hacks/write-inkscape-extension-create-multiple-duplicates/

I will give this a try on my tiled star svg file and report back.

RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

hulf2012
Posts: 716
Joined: Sat Nov 24, 2012 12:37 pm

Re: batch exporting selections to separate svg files

Postby hulf2012 » Thu Apr 18, 2013 3:01 am

Hello,
Some time ago, I found a script which convert groups to layers. I modified it to convert paths to layers. I think that if you have your drawing divided in groups, that groups can be converted to diferent files.

So the answer is NO. But it can be done
If you have problems:
1.- Post a sample (or samples) of your file please.
2.- Please check here:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/index.html
3.- If you manage to solve your problem, please post here your solution.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: batch exporting selections to separate svg files

Postby Lazur » Thu Apr 18, 2013 4:08 am

sanzoghenzo wrote:sorry, what I wanted to say is that the author of the svg uses the png export, but I wanted to save as SVG.
for now I solved by manually ctrl+c,crtl+n,crtl+v,ctrl+w like 80 times :)
I wonder if there's an automated way to do that, if I'll ever have to use it on a huge svg...


You said you solved by creating about 80 separate svg-s out of the one containing 264 separate groups.
Not that I could code anything close to such needs, but I think you could make separate svg-s of each group.
Not from three separate ones, with "random" placement.

Also, you want to use the result svg-s in qgis, so saving in inkscape svg is not necessary.
Your original inkscape svg is made up from 8285 lines, while the same result could be made from 6020 lines in plain svg.

Another thing that I noticed, is how small inaccuracy is stored in each group.
For the 18*18 pixel sized icons you have background rectangles with such sizes:
height="18.000031"
width="18.000017"
width="18.000017"
height="18.000031"
Sorry I have no idea on how to correct them.

sanzoghenzo
Posts: 22
Joined: Wed Dec 12, 2012 8:04 pm

Re: batch exporting selections to separate svg files

Postby sanzoghenzo » Thu Apr 18, 2013 5:11 am

Hi Lazur,
Lazur URH wrote:You said you solved by creating about 80 separate svg-s out of the one containing 264 separate groups.

I extracted only the 24x24px (and not all of them, because I don't need them at the moment). maybe the smaller ones can be useful, but not until an automated way will show up (I'm a lazy boy!)
Lazur URH wrote:Not that I could code anything close to such needs, but I think you could make separate svg-s of each group.

I took a look at the XML and I thought the same. It could be done pretty easily, if only I know how to do it! :)
Lazur URH wrote:Another thing that I noticed, is how small inaccuracy is stored in each group.
...
Sorry I have no idea on how to correct them.

no problem, such small inacuracy couldn't be noticed inside a map like the one I have to deal with, I can live with that ;)
Thanks for your time and help!

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: batch exporting selections to separate svg files

Postby ragstian » Mon Apr 22, 2013 9:12 am

Hi.

Good news for you! Just in;

viewtopic.php?f=20&t=13942

Good Luck
RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

sanzoghenzo
Posts: 22
Joined: Wed Dec 12, 2012 8:04 pm

Re: batch exporting selections to separate svg files

Postby sanzoghenzo » Mon Apr 22, 2013 3:28 pm

Great! Thank you, I'm gonna try it soon!


Return to “Help with using Inkscape”