Register
It is currently Mon Apr 21, 2014 6:12 am

bbcolorize - Colorizes all .jpg images in the directory.


All times are UTC - 6 hours


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

Joined: Sun May 15, 2005 9:36 pm
Posts: 657
Location: Des Moines, Iowa
Code:
#!/bin/bash
# FILE : bbcolorize
# Function: Converts all .jpg images in the directory to colorized.
# Copyright (C) 2006-2009 Dave Crouse <crouse@usalug.net>
# ------------------------------------------------------------------------ #
if [[ $1 = "--help" || $1 = "-h" || $1 = "help" ]]; then
        echo "          Function: Converts all .jpg images in the directory to colorized.";
        echo "          USAGE: $0 red% green% blue%";
        echo "          Requires: Imagemagick";
        echo "          EXAMPLE: $0 0 50 50";
        echo "          ";
        echo "          Specify the amount of colorization as a percentage. ";
        echo "          You can apply separate colorization values to the red, ";
        echo "          green, and blue channels of the image with a colorization ";
        echo "          value.";
        echo "          ";
        echo "          0=normal";
        echo "          50=50% REMOVED";
        echo "          99=99% REMOVED";
        echo "          ";
        echo "          ";
        echo "          Colorization value for red 0-99 is the firt variable.";
        echo "          Colorization value for green 0-99 is the second variable.";
        echo "          Colorization value for blue 0-99 is the third variable.";
        echo "          ";
        echo "          IE: If you make red=0 green=50 and blue=0, then 50% of the green ";
        echo "          will be REMOVED, and the red and blue channels left normal, which ";
        echo "          will leave more red and blue, making the image more purple.";
        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" || -z "$2" || -z "$3" ]]; then
        echo " ";
        echo "          ######### COMMAND FAILED ########## ";
        echo "          USAGE: $0 red% green% blue%";
        echo "          EXAMPLE: $0 0 50 50";
        echo "          ";
        echo "          Specify the amount of colorization as a percentage. ";
        echo "          You can apply separate colorization values to the red, ";
        echo "          green, and blue channels of the image with a colorization ";
        echo "          value.";
        echo "          ";
        echo "          0=normal";
        echo "          50=50% REMOVED";
        echo "          99=99% REMOVED";
        echo "          ";
        echo "          ";
        echo "          Colorization value for red 0-99 is the firt variable.";
        echo "          Colorization value for green 0-99 is the second variable.";
        echo "          Colorization value for blue 0-99 is the third variable.";
        echo "          ";
        echo "          IE: If you make red=0 green=50 and blue=0, then 50% of the green ";
        echo "          will be REMOVED, and the red and blue channels left normal, which ";
        echo "          will leave more red and blue, making the image more purple.";
        echo "          ";
        echo "          ######### COMMAND FAILED ########## ";echo " ";
        exit
else

export IFS=$'\n';
for i in $(find . -maxdepth 1 -type f -iname "*.jpg");
do
convert -colorize $1,$2,$3 ${i:2} _${i:2};
mv _${i:2} ${i:2}
echo "Colorized 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 1 guest


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