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. |
Enhances the shadows and/or highlight regions in an image. |
last modified: December 15, 2018
USAGE: duotonemap [-m mode] [-b bias] [-t thresh] [-s sgamma] [-h hgamma] [-r ramp] [-l lower] [-u upper] infile outfile
-m .... mode ...... mode of operation; choices are: shadows, highlights or PURPOSE: Enhances the shadows and/or highlight regions in an image. DESCRIPTION: DUOTONEMAP enhances the shadows and/or highlight regions in an image. This is done by adjusting the gamma in each region as defined by a threshold of the image used as a mask. Processing is nominally automatic, but can be overridden with manual settings. This is similar to Photoshop's Shadows/Highlights function. ARGUMENTS: -m mode ... MODE of operation that specifies to adjust shadows or highlights or both. Choices are shadows (or s), highlights (or h) or both (or b). The default=both -b bias ... BIAS is the percent shift of the mean value of the input that is is used as the nominal threshold value between shadows and highlights. Values are positive or negative floats. The default=0 indicates no change from the global mean value of all channels of the input image. -t thresh ... THRESH is the user specified threshold value. When used, it overrides the automatic value from the (mean + bias) value. Values are floats between 0 and 100. The default is to use automatic value from the (mean + bias). -s sgamma ... SGAMMA is the gamma value to use in the shadow region. When provided it overrides the automatic value determined from the mean value in the shadows and the "lower" graylevel parameter. Values are floats>0. A value of sgamma=1 produces no change. Smaller/larger values produce darker or brighter results in the shadows. The default is to use the automatically computed value. -h hgamma ... HGAMMA is the gamma value to use in the highlight region. When provided it overrides the automatic value determined from the mean value in the highlights and the "upper" graylevel parameter. Values are floats>0. A value of hgamma=1 produces no change. Smaller/larger values produce darker or brighter results in the highlights. The default is to use the automatically computed value. -r ramp ... RAMP is the transition distance in pixels between the shadows and highlights. Values are integers>=0. The default=20. -l lower ... LOWER is the graylevel value used with the mean value of the shadows to compute the shadow gamma. Values are in the range 0<=float<=1. Smaller/larger values produces darker/brighter results. The default=0.5 -u upper ... UPPER is the graylevel value used with the mean value of the highlights to compute the highlight gamma. Values are in the range 0<=float<=1. Smaller/larger values produces darker/brighter results. The default=0.7 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. |
Example 1 |
|||
Original |
Arguments: |
redist 40,70,70 |
-auto-level |
Example 2 |
|
Original |
redist 50,70,70 |
Arguments: |
Arguments: |
Example 3 |
|
Original |
redist 50,50,40 |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
Example 4 |
|
Original | |
Arguments: |
redist 60,60,60 |
What the script does is as follows:
This is equivalent to the following IM commands
|