Code:
#!/bin/bash
# FILE : bbflip
# Function: Flips all .jpg images in a directory upside down. Creates mirror image Top-Bottom.
# Copyright (C) 2006-2009 Dave Crouse <crouse@usalug.net>
# ------------------------------------------------------------------------ #
if [[ $1 = "--help" || $1 = "-h" || $1 = "help" ]]; then
echo " Function: Flips all .jpg images in a directory upside down. Creates mirror image Top-Bottom.";
echo " Usage: $0 ";
echo " Requires: Imagemagick";
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
export IFS=$'\n';
for i in $(find . -maxdepth 1 -type f -iname "*.jpg");
do
echo "Flipping ${i:2}" # Comment out this line to remove output text.
convert -flip ${i:2} new_${i:2}; mv new_${i:2} ${i:2}
done
exit 0