Register
It is currently Sat Apr 19, 2014 2:26 am

bbgamma - Gamma correct all .jpg images.


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Fri Feb 06, 2009 6:18 am   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 657
Location: Des Moines, Iowa
Code:
#!/bin/bash
# FILE : bbgamma
# Function: Gamma correct all .jpg images in the directory.
#           Will either lighten or darken an image depending on the amount of gamma correction required.
#           The same color image displayed on two different workstations may look different due to differences
#           in the display monitor. Use gamma correction to adjust for this color difference. Reasonable values
#           extend from 0.8 to 2.3. Gamma less than 1.0 darkens the image and gamma greater than 1.0 lightens it.
# Copyright (C) 2006-2009 Dave Crouse <crouse@usalug.net>
# ------------------------------------------------------------------------ #
if [[ $1 = "--help" || $1 = "-h" || $1 = "help" ]]; then
        echo "          Function: Gamma correct all .jpg images in the directory.";
        echo "          Will either lighten or darken an image depending on the amount of gamma correction required.";
        echo "          The same color image displayed on two different workstations may look different due to differences ";
        echo "          in the display monitor. Use gamma correction to adjust for this color difference. Reasonable values ";
        echo "          extend from 0.8 to 2.3. Gamma less than 1.0 darkens the image and gamma greater than 1.0 lightens it.";
        echo "          Usage: $0 gamma_number";
        echo "          Requires: Imagemagick";
        echo "          EXAMPLE: $0 2.0";
        echo "          Specify the value between (0.8 - 2.3) 0.8 creating darker images, 2.3 creating lighter images.";
        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 gamma_number";
        echo "          EXAMPLE: $0 2.0";
        echo "          Specify the value between (0.8 - 2.3) 0.8 creating darker images, 2.3 creating lighter images.";
        echo "          ######### COMMAND FAILED ########## ";echo " ";
else

export IFS=$'\n';
for i in $(find . -maxdepth 1 -type f -iname "*.jpg");
do
convert -gamma $1 ${i:2} _${i:2};
mv _${i:2} ${i:2}
echo "Gamma corrected image ${i:2}" ;
done
fi
exit 0


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP