Batch Processing via Command Line - Win32

Post questions on how to use or achieve an effect in Inkscape.
kraig
Posts: 1
Joined: Sat May 08, 2010 11:40 pm

Batch Processing via Command Line - Win32

Postby kraig » Sun May 09, 2010 12:33 am

Hi everyone,

I've spent some time investigating how to work with the Inkscape (0.47) command line on WinXP. Other than some simple format conversions, so far it seems to be a mess.

Here's what I'm trying to do: I have a 3 folders with a total of 49 PDF files. For each, I need to change the stroke width for all elements to 0.75, and change the export area to the size of the object, not a full page. The latter part is easy (-D), I'm struggling with the former.

I do have inkscapec.exe, and I've been playing around a little bit. The verb I seem to need to change stroke width is DialogFillStroke, but I don't know how to use it. To learn what I need to do, I've invoked inkscapec with the --shell flag. Then, I open up a PDF. Now, I need to select all objects (*should* just be one group on PDF import, if that helps). I don't know how to do this - there's the --select= command, but how do I know the OBJECT-ID? How can I do a 'select all'?

Then, I think I need a '--verb=DialogFillStroke'. Now, I know I don't have anything selected, but when I do this, Inkscape accepts my command but doesn't appear to do anything. How do I get it to change the stroke width?

Thanks.

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

Re: Batch Processing via Command Line - Win32

Postby brynn » Sun May 09, 2010 7:35 am

I know there have been other similar topics posted, but I'm not sure if they received any answers. You could search our forums, if you haven't already. If you don't have any luck with the search, please be patient. Unfortunately you might not receive an answer any time soon. It seems that many messages regarding command line uses of Inkscape go unanswered, and I can only assume that there aren't many users knowledgeable with Inkscape from the command line out there.

Meanwhile, if you can answer any of the other messages about command line issues, please feel free to jump in. The more content on command line use that the search spiders/bots/whatever can find, the more it will attract people searching the internet who have Inkscape/command line knowledge. At least that's how it seems to go sometimes. Sorry, I wish I could be more help.

tatankam
Posts: 14
Joined: Mon Jan 11, 2010 8:08 pm

Re: Batch Processing via Command Line - Win32

Postby tatankam » Mon Apr 18, 2011 8:13 pm

Is there a solution about it ?

I need to set the Stroke width by batch but I don't know how to use DialogFillStroke.

Could you help me ?
Thanks.

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

Re: Batch Processing via Command Line - Win32

Postby chriswww » Wed Apr 20, 2011 8:58 am

to select everything use --verb=EditSelectAll
haven't played much with command line inkscape, so can't help with the DialogFillStroke. i suppose a dialog will (virtually) pop up, and you'd simulate using the controls and buttons on it?

danmiller1113
Posts: 1
Joined: Fri Jul 08, 2011 8:26 am

Re: Batch Processing via Command Line - Win32

Postby danmiller1113 » Fri Jul 08, 2011 9:13 am

I am working with a very large collection of SVG/SVGZ files. They come from different sources, and conform to the SVG standards/best practices at varying levels. I would like to pass each image through Inkscape (by "pass", I mean simply open the image, and re-save it). Manually opening and re-saving the images accomplishes what I'm after, but due to the large number of images I'm working with, a manual process is not feasible. I created a utility that invokes Inkscape, opens an image, and exports it to a "Plain SVG". Here are the command line and switches I used:

Inkscape --export-plain-svg=output.svg input.svg

Unfortunately, exporting my images to the Plain SVG format causes some of the data in some of the images to be lost. Saving them as Inkscape SVGs does what I want, but in all the many places I have searched, there does not seem to be a way to do this on the command line. Is there some way I can use Inkscape on the command line to simply open a file and resave it? For example:

Inkscape --export-inkscape-svg=output.svg input.svg <--- I know this doesn't work

Thanks in advance ;)

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

Re: Batch Processing via Command Line - Win32

Postby brynn » Fri Jul 08, 2011 3:07 pm

Image
Welcome to InkscapeForum!

I'm sorry I can't answer your question. But I will be interested to learn why this can be done with Plain SVG and not Inkscape SVG!

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

Re: Batch Processing via Command Line - Win32

Postby chriswww » Mon Jul 18, 2011 1:33 am

so what exactly does inkscape do to the svg files?..that you're after.
surely you can achieve same effect much quicker with a short programming script or regular expression etc to insert those bits into the svg (xml file) without starting inkscape (many) times?

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

Re: Batch Processing via Command Line - Win32

Postby brynn » Mon Jul 18, 2011 7:22 am

chriswww wrote:so what exactly does inkscape do to the svg files?..that you're after.


danmiller1113 wrote:They come from different sources, and conform to the SVG standards/best practices at varying levels. I would like to pass each image through Inkscape (by "pass", I mean simply open the image, and re-save it).


I believe that dan wants complete comformity to SVG standards, and thinks that saving with Inkscape will accomplish this. It sounds reasonable to me, although I'm not very knowledgeable about SVG standards.

chriswww wrote:surely you can achieve same effect much quicker with a short programming script or regular expression etc to insert those bits into the svg (xml file) without starting inkscape (many) times?

I think that he doesn't know what bits need to be inserted into which files. I think that he's not trying to start Inkscape many times -- isn't that what he avoids, with the batch processing from command line? Just my interpretation :D

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

Re: Batch Processing via Command Line - Win32

Postby chriswww » Mon Jul 18, 2011 10:28 am

doesn't it mean though that inkscape will be called for every input file separately?
if you invoke with --shell, then you can just feed commands to it.
can't get the shell and without gui working on mac...but if you have a look at this page http://tavmjong.free.fr/INKSCAPE/MANUAL ... dLine.html it explains how to use inkscape with --verb commands, one of which is FileSave.

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

Re: Batch Processing via Command Line - Win32

Postby brynn » Mon Jul 18, 2011 12:26 pm

Yeah, I'll have to defer to your expertise on that. My only concept of the command line, is that it's a shortcut using some kind of code. My understanding of "start Inkscape" is opening the program. I hope you can understand my reasoning there. Hopefully danmiller1113 will return to discuss it personally :D

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

Re: Batch Processing via Command Line - Win32

Postby chriswww » Tue Jul 19, 2011 6:59 pm

ok..on windows 7 inkscape, get a command line (i.e. Run command, command is cmd.exe). cd into \Program Files (x86)\Inkscape folder. now you can start inkscape and run commands interactively with command: inkscape -z --shell
that will put you into a command mode where you can enter commands interactively. For a list of those commands you can specify with --verb, inkscape -z --verb-list | more
then you can type in commands like
--verb FileOpen whateverfile.svg --verb FileSaveAs whateverfile2.svg
for filenames that have folder names, use double backslash instead of single backslash.
it doesn't work though just as simple as above. i.e. you'll need to play with it a bit to get the save happening. but this is (at least) the way to invoke save command in command line mode. then the idea is that you can hopefully pre-create this command file for all your filenames, and run it in one swoop.
this should put you on the right track to getting there.


Return to “Help with using Inkscape”