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. |
Modifies an image to automatically apply a gamma correction. |
last modified: December 15, 2018
USAGE: autogamma [-c colormode] infile outfile
-c .... colormode ..... colorspace/channel to use to compute PURPOSE: To modify an image to automatically apply a gamma correction. DESCRIPTION: AUTOGAMMA modifies an image to automatically apply a gamma correction. The gamma value may be computed from various graylevel representations of the image or individually channel-by-channel. The script then passes the gamma value to the IM function -gamma. If the minimum and maximum image statistics are not pure black and white, then you may want to use the autolevel script, so that you get the full benefit of the dynamic range stretch as well. ARGUMENTS: -c colormode ... COLORMODE is the colorspace/channel to use to compute the minimum, maximum and gamma values. The choices are: gray, intensity, luminance, lightness, brightness, average, magnitude and rgb. Values of gray and intensity are equivalent. The default is luminance. -m midrange ... MIDRANGE value from which to compute gamma. Values are 0<floats<1. Default=0.5.
Gray or Intensity uses statistics from -colorspace Gray. Note: generally there are only slight differences between the various non-rgb colormode results. Colormode=rgb can cause color balance shifts. Gamma = log(mean)/log(mid-dynamic-range) Note: there is one internal parameter, midrange, that can be adjusted if you want to bias the gamma slightly. See the default values section. You can also change the default colormode in the default values. 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. |
Colormode Results On Dark Image | |||||
Original Image |
Arguments: |
||||
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Original Image |
Arguments: |
Original Image |
Arguments: |
Original Image |
Arguments: |
Original Image |
Arguments: |
Original Image |
Arguments: |
Original Image |
Arguments: |
Original Image |
Arguments: |
What the script does is as follows:
This is equivalent to the following IM commands for the luminosity colormode.
|