Skip to content

Instantly share code, notes, and snippets.

@vencax
Forked from JasonMillward/CleanupLeafletMap.sh
Last active August 29, 2015 14:19
Show Gist options
  • Save vencax/5db701818b7132824f50 to your computer and use it in GitHub Desktop.
Save vencax/5db701818b7132824f50 to your computer and use it in GitHub Desktop.
#!/bin/bash
for file in `find . -type f -iname "*.png"`
do
echo -n "processing $file ... "
isWhite=`convert $file -colorspace HSL -channel g -separate +channel -format "%[fx:mean]" info:`
if [ "$isWhite" == "0" ]
then
rm $file
echo "white $file removed"
else
# floodfill - to ne
#convert $file -bordercolor white -border 1x1 \
# -alpha set -channel RGBA -fuzz 10% \
# -fill none -floodfill +0+0 white \
# -shave 1x1 $file
# smazani bile
convert $file -channel rgba -alpha set -fill none -opaque white $file
# smazani bile s toleranci
# convert $file -channel rgba -alpha set -fuzz 10% -fill none -opaque white $file
echo "converted"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment