Created
January 27, 2014 15:29
-
-
Save kyon0304/8650526 to your computer and use it in GitHub Desktop.
Recursively go through directory and make *.png *.jpg file gradient transparent(half to bottom). ImageMagick needed.
This file contains 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 | |
#caution!! for file name with spaces may fail | |
for f in *.png *.jpg | |
do | |
size=`convert $f -ping -format "%wx%h" info:` | |
echo $size >> tmp | |
mkdir -p "$size" && cp $f "$size" | |
done | |
cat tmp | sort -u > index.log | |
echo "category done" | |
while read dir | |
do | |
mkdir -p gradients && convert -size $dir gradient: -sigmoidal-contrast 5,10% gradients/$dir.png | |
done < index.log | |
echo "touch gradients done." | |
while read dir | |
do | |
cd $dir | |
for j in `ls` | |
do | |
mkdir -p ../trans && convert $j ../gradients/$dir.png -alpha Off -compose CopyOpacity -gravity South -composite ../trans/$j | |
done | |
cd .. | |
done < index.log | |
echo "compose transparent done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment