Last active
August 29, 2015 14:14
-
-
Save JasonMillward/db35ccb0820d0e61f196 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find . -type f -iname "*.png" -print0 | while IFS= read -r -d $'\0' file; do | |
isWhite=`convert $file -colorspace HSL -channel g -separate +channel -format "%[fx:mean]" info:` | |
if [ "$isWhite" == "0" ] | |
then | |
rm $file | |
else | |
convert $file -bordercolor white -border 1x1 \ | |
-alpha set -channel RGBA -fuzz 10% \ | |
-fill none -floodfill +0+0 white \ | |
-shave 1x1 $file | |
convert $file -channel rgba -alpha set -fuzz 10% -fill none -opaque white $file | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I have made a little change, maybe you will like it: https://gist.github.com/vencax/5db701818b7132824f50