bin/transparent: initial version

This commit is contained in:
xeruf 2022-07-06 09:33:08 +02:00
parent 48f21cd4a0
commit bee07eedbd
1 changed files with 9 additions and 0 deletions

9
.local/bin/scripts/transparent Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh -ex
# Turn white (or another color) into transparent for the given images
# TODO https://safe.duckduckgo.com/?q=imagemagick+color+to+alpha&ia=web https://stackoverflow.com/questions/26408022/imagemagick-color-to-alpha-like-the-gimp/27194202#27194202
case $1 in (-*) color=${1#-};; esac
for arg
do extension="-transparent.${arg##*.}"
case $extension in (*jp*g) extension=".png";; esac
convert "$arg" -transparent ${color:-white} -fuzz 60% "$arg$extension"
done