hi all!
I have been using the command line to convert .avi video to png's, autotrace the png's to svg, convert the svg's to png and finally convert the png's back to avi.
why?
for several reasons, I like the look of the result, you can 'scale' a small video into HD.
here's an example of the end result. WATCH IN FULL HD, please
http://www.youtube.com/watch?v=R8zW2MHhgUE
Up until now, I have not been using inkscape, in this process, but It is my tool of choice for drawing and tracing svgs by hand, I love it!
THE QUESTION!
I need to simplify (all paths in) around 3000 svgs, I really like the way the Simplify tool works in inkscape, but doing this manually would be time and coffee consuming.
How can I batch simplify a bunch of svg's using inkscape simplify in the command-line?
Lars
batch simplify svgs
Re: batch simplify svgs
Are you in Windows? If so, you can write this in the command line:
for %n in (*.svg) do inkscape --file="%n" --verb=EditSelectAll --verb=SelectionSimplify --verb=FileSave --verb=FileClose
If your're in Linux or Mac, then I'll have to try how to do that, cos I've no idea. The part that loops through files is the one that would change, the "inkscape --file..." would be the same.
for %n in (*.svg) do inkscape --file="%n" --verb=EditSelectAll --verb=SelectionSimplify --verb=FileSave --verb=FileClose
If your're in Linux or Mac, then I'll have to try how to do that, cos I've no idea. The part that loops through files is the one that would change, the "inkscape --file..." would be the same.
Re: batch simplify svgs
Fairly similar in Linux (note that this is all one line - the forum software wraps it on my screen):
Two things to note:
1) I haven't tried this, I've just converted the FOR loop from Uktrunie's reply into Bash format for the most common Linux shell
2) Linux filesystems are usually case sensitive, so this won't work if your files have "SVG" as the extension, rather than "svg". You can change the *.svg accordingly, or modify it to *.[sS][vV][gG] to catch any mixture of cases.
Code: Select all
for n in *.svg; do inkscape --file="$n" --verb=EditSelectAll --verb=SelectionSimplify --verb=FileSave --verb=FileClose; done
Two things to note:
1) I haven't tried this, I've just converted the FOR loop from Uktrunie's reply into Bash format for the most common Linux shell
2) Linux filesystems are usually case sensitive, so this won't work if your files have "SVG" as the extension, rather than "svg". You can change the *.svg accordingly, or modify it to *.[sS][vV][gG] to catch any mixture of cases.
Re: batch simplify svgs
Well, mine works. The only thing that doesn't quite work is that you'll see the Inkscape window opening and closing for every file. There's an option that you can add to that line, --without-gui, but for what I read, it doesn't work in Windows (it does work in Linux)
Re: batch simplify svgs
Uktrunie wrote:The only thing that doesn't quite work is that you'll see the Inkscape window opening and closing for every file. There's an option that you can add to that line, --without-gui, but for what I read, it doesn't work in Windows (it does work in Linux)
Adding '--without-gui' won't help with the mentioned task on Linux either: if you want to use verbs from the command line Inkscape needs to open a GUI window, else the verbs are not executed (this is independent of the platform inkscape is running on). On linux could can use Xvfb and set $DISPLAY for the inkscape command line process to the one of the virtual frame buffer, if you want to "hide" the Windows from the current display.
-
- Posts: 7
- Joined: Mon Nov 28, 2011 9:35 am
Re: batch simplify svgs
thank you all, it seem to work, except for that the gui opens... and I guess that's a bit processor and ram consuming, so if anyone know of a way, or another program/ solution, please let me know.
I have tried SVG Cleaner, but it gives really strange results.
by the way, is there some other vector graphics forum out there, that deals with vector graphics, without beig tied to a specific program?
Lars
I have tried SVG Cleaner, but it gives really strange results.
by the way, is there some other vector graphics forum out there, that deals with vector graphics, without beig tied to a specific program?
Lars