Reputation: 3785
I need to do some batch processing of svg files. SVG elements are all either black or white and I need bitmap images that are monochrome (black/white, no grayscale).
From within the inkscape gui I can just select this as an option.
However, I don't see any inkscape cli options related to antialiasing
Same for librsvg, (rsvg-convert) no command line options in the manual related to anti-aliasing.
Second thought was to just export to a png image and then use ImageMagick to threshhold the image. However, on my system
Mac OSX catalina (latest)
brew install imagemagick -> 7.0.10-23
when I run the following, i get an error:
>>> convert test.im.png -channel RGB -threshhold 50% test.im.t.png
convert: unrecognized option `-threshhold' @ error/convert.c/ConvertImageCommand/3112.
looking for a little help on how to get from a black and white svg to a black and white png on the command line for batch processing given these problems.
Upvotes: 2
Views: 5685
Reputation: 4919
It seems this will be added in version 1.4 of inkscape, which as of now (March 2024) needs to be compiled manually. It's not in the linux ppa 1.3 version yet either.
Have compiled and tested, works well.
The new --export-png-antialias
command line option, which you can set to 0 (none) to 3 (best)
Here is the source code showing the new version:
Upvotes: 1
Reputation: 53081
On IM 7, use magick, not convert. So try
magick +antialias image.svg -channel RGB result.png
or
magick image.svg -channel RGB -threshold 50% result.png
If one of these works, then you can process a whole folder of files using magick mogrify. See https://imagemagick.org/Usage/basics/#mogrify
Upvotes: 1