Batch processing from the command line

Post questions on how to use or achieve an effect in Inkscape.
grashopa
Posts: 2
Joined: Sun Jul 31, 2011 11:51 pm

Batch processing from the command line

Postby grashopa » Sun Jul 31, 2011 11:55 pm

I'm not sure this is an inkscape questions, but apparently inkscape cannot find my svg files when I run using some kind of batch. Either as a .bat file or in python using os.system calls. If I run each line individually from the same directory on the command line it works fine... Can someone post how they have run a batch of inkscape command lines in case I'm doing something wrong?

Under cygwin I created to_png.bat and just filled it with inkscape command lines used to convert my SVG files to PNG. If I run these commands myself on the command line they will execute successfully. If I run the to_png.bat file I get the following error:

** (inkscape.exe:3856): WARNING **: Specified document 'svgs/ace.svg' cannot be opened (does not exist or not a valid SVG file)

I am running from the same directory of course and I also tried specifying the absolute path in case somehow the working directory inkscape saw was different when running the .bat file. I just did this using python and os.system calls and had the same problem.

to_png.bat:

inkscape -h 120 -e 'pngs/ace.png' 'svgs/ace.svg'
inkscape -h 120 -e 'pngs/king.png' 'svgs/king.svg'
inkscape -w 120 -e 'pngs/queen.png' 'svgs/queen.svg'

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: Batch processing from the command line

Postby chriswww » Mon Aug 01, 2011 12:38 am

a .bat file is executed by windows command line interpreter. if you want it handled by cygwin bash shell instead-as it understands forward slash path separator-then rename your .bat to a .sh
anyhow that's what it's complaining about. as windows uses backslash as path separator

grashopa
Posts: 2
Joined: Sun Jul 31, 2011 11:51 pm

Re: Batch processing from the command line

Postby grashopa » Mon Aug 01, 2011 12:53 am

Thanks got it now, not only that in .bat files you need to use double quotes " instead of the single.

chriswww
Posts: 383
Joined: Fri Nov 19, 2010 3:04 pm

Re: Batch processing from the command line

Postby chriswww » Mon Aug 01, 2011 12:17 pm

i noticed your queen is getting width adjusted instead of height...or is that correct or just typo in this posting?
how do you make sure the export is aligned to the pixel grid when calling inkscape in batch mode?
have fun with cygwin


Return to “Help with using Inkscape”