Advertisement
Guest User

Untitled

a guest
May 28th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. for file in `find . -type f -iname "*.png"`
  4. do
  5. echo -n "processing $file ... "
  6.  
  7. isWhite=`convert $file -colorspace HSL -channel g -separate +channel -format "%[fx:mean]" info:`
  8.  
  9. if [ "$isWhite" == "0" ]
  10. then
  11. rm $file
  12. echo "removed"
  13. else
  14. convert $file -bordercolor white -border 1x1 \
  15. -alpha set -channel RGBA -fuzz 10% \
  16. -fill none -floodfill +0+0 white \
  17. -shave 1x1 $file
  18.  
  19. convert $file -channel rgba -alpha set -fuzz 10% -fill none -opaque white $file
  20. echo "converted"
  21. fi
  22. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement