Reputation: 43421
I got the following script to export my *.svg
to .png
in various sizes.
#!/usr/bin/env bash
[[ ! -d png ]] && mkdir png/
for svg in logo.*.svg; do
echo $svg $png
sizes=( 64 128 256 512 1024 )
for size in "${sizes[@]}"; do
png="png/${svg//.svg/.$size.png}"
[[ $png =~ vertical ]] && inkscape --without-gui --export-height=$size --export-png="$png" --file="$svg"
[[ $png =~ horizontal ]] && inkscape --without-gui --export-width=$size --export-png="$png" --file="$svg"
done
done
As I want to export both monochrome (black & white) and colour version I currently have both SVG version:
How can I improve my script to export in monochrome without the need to have a SVG file in monochrome?
There is a verb
, but not sure how to use it:
org.inkscape.effect.filter.Silhouette: Repaint anything visible monochrome
Upvotes: 0
Views: 560
Reputation: 43421
Thanks @Bonanza for the bump
Here are my BATS tests and the related code to do the conversion. It boil down to:
convert PNG to monochrome with convert
convert "$png" -colorspace Gray "$monochrome"
Upvotes: 0