Skip to content

Instantly share code, notes, and snippets.

@KhasMek
Created June 7, 2012 17:00
Show Gist options
  • Save KhasMek/2890061 to your computer and use it in GitHub Desktop.
Save KhasMek/2890061 to your computer and use it in GitHub Desktop.
simple script to find and colorize file in a folder(s) (rainbow edition)
#!/bin/bash
#
# A simple colorizer script for ImageMagick to batch modify
# resource images.
# -KhasMek
file=${1}
location=${2}
if [ ! "$location" ]; then
location=.
fi
if [ ! "$file" ]; then
file=*.png
fi
find $location -name $file | while read line
do
# I don't think this will actually be necessary.
#if [ find $line -name *.9.png ! = "" ]; then
# echo "$line is a 9 png, cropping"
# convert $line -crop 1x1+1+1 +repage $line
#fi
hue=$[ ( $RANDOM % 300 ) + 1 ]
echo "colorizing $line to hue $hue"
# Brightness, Saturation, Hue.
convert $line -modulate 100,10,$hue $line
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment