command line export with color inversion

Post questions on how to use or achieve an effect in Inkscape.
danmc
Posts: 3
Joined: Mon Jul 27, 2015 10:40 pm

command line export with color inversion

Postby danmc » Tue Jul 28, 2015 4:14 am

Hello,

I am using inkscape 0.91 under windows and have cygwin installed so I can use make to process a bunch of .svg files more easily.

I have a bunch of black on transparent drawings (transparent background, black text, black paths, and black bitmap images) to export to PNG but I want to make the background white and then invert all colors first.

I tried:

Code: Select all

/cygdrive/c/Program\ Files\ \(x86\)/Inkscape/inkscape.com  \
        my_drawing.svg  \
        --verb=EditSelectAll \
        --verb=org.inkscape.effect.filter.f031.noprefs \
        --export-area-page  \
        --export-dpi 300 \
        --export-png=tmp.png  \
        --export-background=white


I found the second --verb argument by

Code: Select all

/cygdrive/c/Program\ Files\ \(x86\)/Inkscape/inkscape.com  --verb-list | grep -i invert


I also tried using negative instead of the f031 (invert) with:

Code: Select all

 --verb=org.inkscape.color.negative.noprefs


Am I doing something fundamentally wrong or is it just a minor misconception leading to an easily fixable solution?

Thanks in advance
-Dan

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

Re: command line export with color inversion

Postby brynn » Tue Jul 28, 2015 10:32 am

This probably won't help. But just in case. https://inkscape.org/en/doc/inkscape-man.html

danmc
Posts: 3
Joined: Mon Jul 27, 2015 10:40 pm

Re: command line export with color inversion

Postby danmc » Tue Jul 28, 2015 12:23 pm

It is the manual which got me to the point where I am (png export working but the --verb part not working)

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

Re: command line export with color inversion

Postby ~suv » Tue Jul 28, 2015 1:14 pm

I haven't spent time yet trying to run this locally, but at first sight you'll likely need to run two separate loops / inkscape processes - one to apply the verb (save the changes with '--verb=FileSave' and '--verb=FileQuit'), and another loop which then exports the saved version to PNG.
Last edited by ~suv on Tue Jul 28, 2015 1:21 pm, edited 1 time in total.

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

Re: command line export with color inversion

Postby ~suv » Tue Jul 28, 2015 1:20 pm

Personally, I'd probably prefer to use one of the 'org.inkscape.color.*' verbs (if applicable) - these are the extensions which actually modify the RGB values applied in the 'style' attribute of vector elements (won't affect bitmap images).

The 'org.inkscape.effect.filter.*' verbs on the other hand will apply one of the preset filter effects (see also menu 'Filters') - they will also work for linked/embedded bitmap images.

danmc
Posts: 3
Joined: Mon Jul 27, 2015 10:40 pm

Re: command line export with color inversion

Postby danmc » Tue Jul 28, 2015 1:33 pm

~suv wrote:I haven't spent time yet trying to run this locally, but at first sight you'll likely need to run two separate loops / inkscape processes - one to apply the verb (save the changes with '--verb=FileSave' and '--verb=FileQuit'), and another loop which then exports the saved version to PNG.



Ah. That was the missing bit. Needed to save the change before export. Here is what I'm using now:

Code: Select all

cp my_drawing.svg tmp.svg

/cygdrive/c/Program\ Files\ \(x86\)/Inkscape/inkscape.com  \
        tmp.svg \
        --verb=EditSelectAll \
       --verb=org.inkscape.effect.filter.f031.noprefs \
        --verb=FileSave \
        --verb=FileQuit

# this works for text and lines but not bitmaps:
#        --verb=org.inkscape.color.negative.noprefs \


/cygdrive/c/Program\ Files\ \(x86\)/Inkscape/inkscape.com  \
        tmp.svg \
        --export-area-page  \
        --export-dpi 300 \
        --export-png=tmp.png \
        --export-background=black




It seems to be working now. Thanks!


-Dan


Return to “Help with using Inkscape”