Fred's ImageMagick Scripts



    Licensing:

    Copyright © Fred Weinhaus

    My scripts are available free of charge for non-commercial (non-profit) use, ONLY.

    For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net.

    If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment.

    Usage, whether stated or not in the script, is restricted to the above licensing arrangements. It is also subject, in a subordinate manner, to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php

    Please read the Pointers For Use on my home page to properly install and customize my scripts.

AUTOTONE


Automatically tone balances an image.

Download Script

last modified: December 15, 2018



USAGE: autotone [-b] [-g] [-w] [-G] [-n] [-s] [-p] [-R resize] [-P percent]
[-M midrange] [-N noise] [-S sharp] [-WN whitenorm] [-GN graynorm]
infile outfile

USAGE: autotone [-h or -help]

-b .................... disable auto brightness/contrast
-g .................... disable auto gray balance
-w .................... disable auto white balance
-G .................... disable auto gamma correction
-n .................... disable auto noise removal
-s .................... disable auto sharpening
-p .................... enable progress monitoring
-R .... resize ........ limit the output size to this value; integer>0;
....................... will resize if the larger dimension of the image
....................... exceeds this value
-P .... percent ....... percent threshold for detecting gray/white
....................... for auto gray and auto white balance; 0<float<100;
....................... default=1
-M .... midrange ...... midrange value for auto gamma correction;
....................... 0<float<1; default=0.425
-N .... noise ......... noise removal factor; integer>0; default is
....................... automatically computed; range is about 1 to 4
-S .... sharp ......... sharpening amount; float>=0; default is
....................... automatically computed; range is about 1 to 4
-WN .... whitenorm .... white balance normalization method; choices are:
....................... none (n), ave (a), max (m); default=none
-GN .... graynorm ..... gray balance normalization method; choices are:
....................... none (n), ave (a), max (m); default=none

PURPOSE: To automatically tone balance an image.

DESCRIPTION: AUTOTONE attempts to automatically tone balance and image. This includes auto brightness/contrast adjustment, auto gray balance, auto white balance, auto gamma correction, auto noise removal and auto sharpening.

ARGUMENTS:

-b ... disable auto brightness/contrast

-g ... disable auto gray balance

-w ... disable auto white balance

-G ... disable auto gamma correction

-n ... disable auto noise removal

-s ... disable auto sharpening

-p ... enable progress monitoring

-R resize ... RESIZE is the limit on the output image size. Values are integer>0. This will only resize if the larger dimension of the image exceeds this value. The default is no limit (i.e. no resize).

-P percent ... PERCENT is the percent threshold for detecting gray/white in the image for auto gray and auto white balance. Values are 0<floats<100. The default=1.

-M midrange ... MIDRANGE value for auto gamma correction. Values are 0<floats<1. The default=0.425.

-N noise ... NOISE removal factor. Values are integers>0. The default is automatically computed. The nominal range is about 1 to 4 depending upon image size. Larger values are used for larger images.

-S sharp ... SHARP is the sharpening amount. Values are floats>=0. The default is automatically computed. The nominal range is about 1 to 4. Larger values are used for larger images.

-WN whitenorm ... WHITENORM is the white balance r,g,b ratio normalization method. The choices are: none (n), ave (a), max (m). The default=none

-GN graynorm ... GRAYNORM is the gray balance r,g,b ratio normalization method. The choices are: none (n), ave (a), max (m). The default=none

NOTE: The white balance and gray balance techniques now have optional r,g,b ratio normalizations that help prevent brightness increases and over-saturation at white from these parts of the script. Furthermore, to avoid possible excess color shifts as well as mitigate over-saturation of white, one may reduce the percent argument to about 0.1. All of the above as well as the midrange argument are subject to personal tastes and tuning. The defaults have been left in the old mode for backward compatibility. I thank Dr. Guenter Grau for the suggestion to normalize the r,g,b ratios in the white balance and gray balance parts of the code. My current recommendation is to use whitenorm=ave, graynorm=ave and percent=0.1.

CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk.


EXAMPLES


Original Image
(http://3.bp.blogspot.com/-iOOnD5rmkxk/Ta7Vi7ePTsI/AAAAAAAAANM/EgDnXlR0HHU/s1600/Chloe%2BBell%2B045.JPG)

 

Arguments:
(defaults)


Original Image
(provided by Anthony Thyssen)

 

Arguments:
(defaults)


Original Image
(http://www.asknlearn.com/EduWiz/help/Chapter9/Chapter9.htm)

 

Arguments:
(defaults)


Original Image
(http://enhance.pho.to/)

 

Arguments:
(defaults)


Original Image
(http://enhance.pho.to/)

 

Arguments:
(defaults)


Original Image
(http://warrencampdesign.com/warren/images/photoEdits/basics/focusContrast/lions_before.jpg)

 

Arguments:
(defaults)


Original Image
(http://digital-photography-school.com/turn-ho-hum-color-into-wow-with-photoshop)

 

Arguments:
(defaults)


Original Image
(http://www.barberdsp.com/images/rhloc.jpg)

 

Arguments:
(defaults)
Arguments:
-G
Arguments:
-M 0.5


What the script does is as follows:

  • Applies brightness/contrast adjustment using -auto-level
  • Applies auto gray balance using -color-matrix
  • Applies auto white balance using -color-matrix
  • Applies auto gamma adjustment using -gamma
  • Applies noise removal using iterations of -enhance
  • Applies sharpening using -unsharp