Created
August 26, 2011 18:30
-
-
Save PatrickTulskie/1174077 to your computer and use it in GitHub Desktop.
Take an image and make it pretty!
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 | |
COLORS=( red green blue cyan magenta yellow orange pink purple ) | |
TMP_DIR=/tmp/colorme/`date +%s` | |
OUTPUT="$HOME/Desktop/animated.gif" | |
DELAY=5 | |
# Create us a temp directory | |
mkdir -p $TMP_DIR | |
# Create a base grayscale image to colorize | |
echo "Creating base image." | |
convert -verbose -colorspace gray $* $TMP_DIR/base.jpg | |
echo "" | |
# Loop through the colors and create images for them | |
echo "Creating colorized images." | |
for i in "${COLORS[@]}"; do | |
convert -verbose -modulate 130 -fill $i -tint 30 $TMP_DIR/base.jpg $TMP_DIR/colored_$i.jpg | |
done | |
echo "" | |
# Build the gif | |
echo "Building the gif and dumping it to $OUTPUT" | |
# convert -verbose -delay $DELAY -loop 0 -resize 500 -layers OptimizeTransparency $TMP_DIR/colored_*.jpg $OUTPUT | |
convert -verbose -delay $DELAY -loop 0 -layers OptimizeTransparency $TMP_DIR/colored_*.jpg $OUTPUT | |
echo "" | |
# Clean up after ourselves | |
echo "Cleaning up temp files." | |
rm -rf $TMP_DIR | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This needs ImageMagick, yo.