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 color balances an image. |
last modified: December 15, 2018
USAGE: autocolor [-m method] [-c clipmode] [-l cliplow] [-h cliphigh] [-n neutralgray] infile outfile
-m .... method .......... method to adjust neutral color; method=gamma, PURPOSE: To automatically color balance an image. DESCRIPTION: AUTOCOLOR automatically color balance and image by shifting the mean value of each channel to the neutral gray value. There are three methods that can be used. The first uses -gamma computed from the neutral gray value and mean of each of the RGB channels. The second uses -recolor (or -color-matrix) computed from the neutral gray value and mean of each of the RGB channels. The third skips this step. In addition to corrrecting the neutral color, the histogram is stretched to full black and white using the clip values. ARGUMENTS: -m method ... METHOD defines how the neutral color will be set. The choices are gamma (g), recolor (r) or none (n). Method=gamma uses -gamma to shift the mean value to neutral gray. Method=recolor uses -recolor (-color-matrix) to shift the mean value to neutral gray. Method=none skips this processing and only does the clip operation. If method=none and clipmode=together, then the result of the script will be equivalent to IM -contrast-stretch with a change in contrast, but no color change. The default=gamma. -c clipmode ... CLIPMODE specifies whether to clip the channels in unison or independently. The choices are: together (t) or separate (s). The default=together Note: generally the best choices seem to be either method=recolor with clipmode=separate or method=gamma with clipmode=together. -l cliplow ... CLIPLOW is the cumulative percent at the low end of the histogram whose graylevel will be stretch to full black. Values are floats between 0 and 100. If cliplow=0, then the stretch will locate the minimum value in the channel histogram. The default=0.1 -h cliphigh ... CLIPHIGH is the cumulative percent at the high end of the histogram whose graylevel will be stretch to full white. Values are floats between 0 and 100. If cliplow=0, then the stretch will locate the maximum value in the channel histogram. The default=same as cliplow. -n neutralgray ... NEUTRALGRAY is the graylevel for a given channel to which the mean value will be adjusted. Values are floats between 0 and 100. The default is computed from the average of the luminance channel. Other choices are 50 for mid-gray or 84 which is equivalent to 18% neutral gray. Using larger values will make the resulting image brighter. 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. |
Variations In Method And Clipmode |
||
Original Image |
Photoshop Autocolor |
GIMP Auto White Balance |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Variations In Method And Clipmode |
||
Original Image |
Photoshop Autocolor |
GIMP Auto White Balance |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Variations In Method And Clipmode |
||
Original Image |
Photoshop Autocolor |
GIMP Auto White Balance |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Variations In Method And Clipmode |
||
Original Image |
Photoshop Autocolor |
GIMP Auto White Balance |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Variations In Method And Clipmode |
||
Original Image |
Photoshop Autocolor |
GIMP Auto White Balance |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
What the script does is as follows:
This is equivalent to the following IM commands for the method=recolor clipmode=separate options.
|