Code:
#!/bin/bash
# FILE : bbsolarize
# Function: "solarizes" all .jpg images in the directory.
# Produces a solarization effect as seen when exposing a photographic
# film to light during the development process.
# Copyright (C) 2006-2009 Dave Crouse <crouse@usalug.net>
# ------------------------------------------------------------------------ #
if [[ $1 = "--help" || $1 = "-h" || $1 = "help" ]]; then
echo " Function: Solarizes all .jpg images in the directory.";
echo " Produces a solarization effect as seen when exposing a photographic";
echo " film to light during the development process.";
echo " Usage: $0 intensity_number";
echo " Requires: Imagemagick";
echo " EXAMPLE: $0 50";
echo " intensity (0 - 99.9) 0 being the most, 99.9 the least. ";
echo " ";
echo " Comments/Suggestions/Bugfixes to <crouse@usalug.net>";
echo " USA Linux Users Group - http://usalug.org";
echo " ";
exit 0
fi
if [[ -z $( type -p convert ) ]]; then echo -e "ImageMagick -- NOT INSTALLED !";exit ;fi
if [ -z "$1" ] ; then
echo " ";
echo " ######### COMMAND FAILED ########## ";
echo " USAGE: $0 intensity_number";
echo " EXAMPLE: $0 50";
echo " intensity (0 - 99.9) 0 being the most, 99.9 the least. ";
echo " ######### COMMAND FAILED ########## ";echo " ";
else
export IFS=$'\n';
for i in $(find . -maxdepth 1 -type f -iname "*.jpg");
do
convert -solarize ${1}% ${i:2} _${i:2};
mv _${i:2} ${i:2}
echo "Solarized image ${i:2}";
done
fi
exit 0