How do I do batch conversions?

Post questions on how to use or achieve an effect in Inkscape.
User avatar
hellocatfood
Posts: 193
Joined: Fri Aug 29, 2008 8:49 pm
Contact:

How do I do batch conversions?

Postby hellocatfood » Mon Jan 24, 2011 10:32 am

I have a 354 of eps, ai and cdr files that I want to convert to svg. Obviously opening each in Inkscape and then saving them via the guy would take a really long time so I was wondering if anyone had any idea on how to do this via the command line (using Ubuntu 10.10) that would preserve the file names as well?

I've tried doing this using uniconverter but keep getting errors whereas it seems inkscape can handle most of the files I throw at it
I'm on The Web | Flickr | tumblr

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

Re: How do I do batch conversions?

Postby brynn » Mon Jan 24, 2011 11:32 am

I seem to recall that IrfanView does batch conversions, but I don't know about SVG. http://www.irfanview.com/

User avatar
hellocatfood
Posts: 193
Joined: Fri Aug 29, 2008 8:49 pm
Contact:

Re: How do I do batch conversions?

Postby hellocatfood » Mon Jan 24, 2011 9:38 pm

Thanks, but I'm using Ubuntu so can't really run Irfanview
I'm on The Web | Flickr | tumblr

markjensen
Posts: 9
Joined: Thu Jan 27, 2011 2:52 am

Re: How do I do batch conversions?

Postby markjensen » Thu Jan 27, 2011 2:56 am

Huh, my post disappeared. Well. I'll try again.

Can you use this page? http://inkscape.modevia.com/inkscape-man.html

I am guessing that you can use the flag --export-plain-svg so you'll just need to iterate through your files. I can't help you with that, sorry, but you can probably find something on google.

User avatar
hellocatfood
Posts: 193
Joined: Fri Aug 29, 2008 8:49 pm
Contact:

Re: How do I do batch conversions?

Postby hellocatfood » Fri Jan 28, 2011 5:42 am

After a lot of searching I eventually had to use lots of different software for each file type. None of them could correctly convert the files, but did a good job most of the time.

For ai files you can use the command line

Code: Select all

inkscape -f infile.ai outfile.svg


For cdr files you have to use uniconvertor (unless someone can tell me how you'd do this using Ghostscript)

Code: Select all

uniconvertor infile.cdr outfile.svg


For eps files Ghostscript gave me the best results, though for svgs with embedded images it tries to trace them, leading to huge file sizes (biggest I got was 223Mb)

Code: Select all

gs -dEPSFitPage -sDEVICE=svg -sOutputFile=outfile.svg infile.eps quit.ps;


If you put these into a loop you can do a batch conversion pretty quickly. I put this into a file called conversion.sh to convert eps files:

Code: Select all

#!/bin/sh
for file in *.eps
do
gs -dEPSFitPage -sDEVICE=svg -sOutputFile=$file.svg "$file" quit.ps;
done


Hope this helps someone!
I'm on The Web | Flickr | tumblr

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

Re: How do I do batch conversions?

Postby brynn » Fri Jan 28, 2011 10:25 am

Wow, nice work hellocatfood! Image

milos.kroulik
Posts: 1
Joined: Thu Oct 03, 2013 7:54 pm

Re: How do I do batch conversions?

Postby milos.kroulik » Mon Oct 07, 2013 6:40 pm

The above mentioned method for converting AI files didn't work very well for me. The files were converted,but were very huge and out of the page. I ended up using two other tools:

The results were fine then.

GeorgeZ
Posts: 6
Joined: Tue Dec 19, 2017 9:39 am

Re: How do I do batch conversions?

Postby GeorgeZ » Sun Jun 10, 2018 12:07 am

Found this post thru google search. I have 407 eps files (created in old version of Adobe Illustrator) to convert to svg files. I found the ghostscript comes with Ubuntu (described above) does not work. So, I tried to use Inkscape command line method. The Inkscape 0.9.23 in Ubuntu 18.04 can import eps files (use apt-get install instead snap install), but there is no command line option to save it as an Inkscape svg. There is an option to save the eps file as plain svg file, which is good enough for my purpose.

Here is the command line to convert one file
inkscape --file=filename.eps --export-plain-svg=filename.svg

The bash script to convert all files in a directory is
#!/bin/sh
#~/Sign_work/eps2svg/eps2svg.sh
# eps2svg.sh file
# the idea comes from a post at this link
# viewtopic.php?t=8374

for file in *.eps
do
inkscape --file="$file" --export-plain-svg="$file".svg
done

It takes about 10 minutes to convert all 407 eps files. I wish someone may find this information useful.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How do I do batch conversions?

Postby Moini » Sun Jun 10, 2018 2:20 am

In the next major version, there's going to be an option to export as inkscape svg: http://wiki.inkscape.org/wiki/index.php ... mmand_Line (not available yet).
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)


Return to “Help with using Inkscape”