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. |
Automatically adjusts the white balance of an image. |
last modified: December 15, 2018
USAGE: autowhite [-m method] [-p percent] infile outfile
-m .... method .......... method to adjust white balance; PURPOSE: To automatically adjust the white balance of an image. DESCRIPTION: AUTOWHITE automatically adjusts the white balance of an image. Two methods are available. Method 1 uses a multiplicative adjustment using -recolor (-color-matrix). Method 2 uses an additive adjustment using -evaluate add. Both methods compute RGB channel averages of a user specified percentage of pixels closest to white. The channel averages are used in a ratio compared with white in method 1 and as a difference from white in method 2. ARGUMENTS: -m method ... METHOD defines how the white balance adjustment will be handled. Method 1 uses a multiplicative adjustment using -recolor (-color-matrix), where the matrix values are the ratios of 100% to the channel averages in percent graylevel. Method 2 uses an additive adjustment using -evaluate add, where the additive amount is the percent difference of the channel averages from 100%. Method 1 is generally superior. Method 2 often shifts the overall color oddly. The default is method=1. -p percent ... PERCENT is the percentage of pixels closest in color to white that is used to compute the average graylevel of each RGB channel in the image. Values are floats between 0 and 100. Default=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. |
Variation In Percent Pixels Used To Compute Average |
|||
Original Image |
Arguments: |
Arguments: |
Arguments: |
Original Image |
Arguments: |
Arguments: |
Arguments: |
Comparison Method 1 And 2 --- Percent=1 |
||
Original Image |
Arguments: |
Arguments: |
Comparison Method 1 And 2 --- Percent=1 |
||
Original Image |
Arguments: |
Arguments: |
Comparison Method 1 And 2 --- Percent=1 |
||
Original Image |
Arguments: |
Arguments: |
Comparison Method 1 And 2 --- Percent=1 |
||
Original Image |
Arguments: |
Arguments: |
What the script does is as follows:
This is equivalent to the following IM commands for method=1.
|