batch export?

Post questions on how to use or achieve an effect in Inkscape.
User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

batch export?

Postby brynn » Sun Aug 09, 2009 1:17 am

Hi Friends,
Is there a way to export a batch of files? In the Export Bitmap dialog, I see the "Batch export all selected objects" option. But from what I can tell from the tavmjong Guide, this is used to export a batch of objects in a single image, creating several PNG files, each containing one of the objects from the original SVG file.

But I have a large number of SVG image files that I want to export to PNG, and I'm wondering if there is a way to export them all at once, rather than one at a time. Is it possible?

Thanks for your help :D

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: batch export?

Postby ~suv » Tue Aug 11, 2009 2:27 am

[You don't mention the OS - so I assume Windows] I am risking an answer even though I don't use Windows and can't help with the specific issues to create the batch files (aka *.bat files). In general you can use the command line interface of Inkscape to export multiple SVG drawings to PNG or other formats. Maybe as first hint this section of the Inkscape FAQ could be helpful: I'm on Windows, and command line parameters don't seem to work! and then the inkscape man page (see also menu 'Help > Command Line Options')

Here are further links I had collected regarding the command line usage on Windows (though they mainly seem to deal with the debugging process - access to inkscape cl output doesn't seem easy ;-):

How to Use Inkscape's Command Line Options on Win32 | kaioa.com:
<http://kaioa.com/node/42>

How to Use Inkscape's Command Line Options on Win32 - Part 2 | kaioa.com:
<http://kaioa.com/node/43>

inkscapec.exe - A Command Line Wrapper for Win32 | kaioa.com:
<http://kaioa.com/node/63>

inkscape-devel mailing list: include inkscapec.exe ?
<http://thread.gmane.org/gmane.comp.graphics.inkscape.devel/30268>

I don't know if there is a (cross-platform) GUI app for Inkscape batch export.


[edit]
maybe the proposal of CarlCravens in this comment could be used for batch export from Inkscape as well?
The Wizard's Apprentice ... http://wizapp.sourceforge.net/

It lets you write batch (or Perl, Python, etc) scripts using GUI dialogs ... not just a launcher at the beginning, but you can take input from a dialog, do some processing, and then pop up another dialog for more input or to show results. Once I get a chance to learn how it works, it should be pretty simple to write a GUI front-end to scour (and, say, uniconvertor) to make them easier for Windows users to deal with. (Heck, one could even write a front-end to a collection of front-ends for these little SVG utilities.)
[/edit]

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

Re: batch export?

Postby brynn » Tue Aug 11, 2009 12:05 pm

Wow ~suv, thanks for all that info!
It will take me quite some time to read and digest it all. The only thing I know about the command line, is that Start > Run sometimes brings up a black box with text inside, that's call the command prompt. So you see I will have a lot to learn. Yes I'm on Windows. Sorry for not mentioning it, I didn't think it mattered. I guess I was hoping for a purely Inkscape function, but I guess it doesn't exist.

Well, I'm sure I will have some questions, but will learn as much as I can on my own first. Meanwhile, I wanted to say thanks :D

DrinkingGypsie
Posts: 1
Joined: Fri Mar 11, 2016 1:26 pm

Re: batch export?

Postby DrinkingGypsie » Fri Mar 11, 2016 1:36 pm

As this is the first google result i came across. For those wanting a quick solution I developed the following which worked for me. It's a windows Batch file that:

  1. Waits for user input of the dimension (It assumes a square output)
  2. Checks for "C:\Program Files\Inkscape\inkscape.exe"
  3. Creates output directory
  4. Iterates through any .svg files from where the Batch file was run and converts them to a png into the output directory
  5. Opens output directory in window explorer and closes the command window

Please note that it exports a SQUARE, with the provided dimension. However you can easily modify it for a rectangle.

batch-export-png.bat

Code: Select all

@echo off
set var=%cd%
set /p size="Enter image size:"
if exist "C:\Program Files\Inkscape\inkscape.exe" (
   rem file exists
   mkdir "%var%\batch-export-png-%size%\"
   for %%f in (*.svg) do (
      echo Processing: %%~nf.svg
      "C:\Program Files\Inkscape\inkscape.exe" -z -f "%var%\%%~nf.svg" -w %size% -h %size% -j -e "%var%\batch-export-png-%size%\%%~nf.png"
   )
   explorer "%var%\batch-export-png-%size%\"
) else (
   rem file doesn't exist
   echo Could not find: "C:\Program Files\Inkscape\inkscape.exe"
)
exit


Return to “Help with using Inkscape”