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. |
Desaturates a specific hue (range) in an image. |
last modified: August 17, 2020
USAGE: unsaturatehue [-h hue] [-u units] [-s saturation] [-r range] [-t taper]
[-c colorspace] infile outfile PURPOSE: To desaturate a given hue (range) in an image. DESCRIPTION: UNSATURATEHUE desaturate a given hue (range) in an image. Hues are arranged in a cyclical order in the range 0 to 100 percent or 0 to 360 degrees. Hues may be desaturated to any amount between 0 and 100 percent. Units for hues may be either percent or degrees. Desaturation can be done in HSL or HCL colorspace. ARGUMENTS:
-h hue ... Hue value to desaturate. The choices are 0
-u units ... UNITS for hue. Choices are percent (p) or degrees (d).
The same units will be used for hue, tolerance and ramp. The default=degrees.
-s saturation ... SATURATION percent. Values are integer>=0. The default=0.
-t tolerance ... TOLERANCE (range) around specified hue to desaturate as
specified by units. Values are 0<=integer<=360 degrees or 0<=integer<=100
percent. The default=30 (degrees).
-r ramping ... RAMPING (tapering) off graduation beyond tolerance as specified by
units. Values are integer>=0. The default=15 (degrees).
-c colorspace ... COLORSPACE in which to desaturate the image. The choices
are: HSL or HCL. The default=HSL.
REQUIREMENTS: IM 6.5.3-7 so that -modulate uses HSL and not HSB colorspace.
HCL modulation is available as of version 6.8.6-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.
|
HUE REFERENCE CHART |
Example 1 |
Original Image |
Arguments: -h 0 -s 0 -u d -t 30 -r 15 -c hsl (desaturate red) |
Example 2 |
Original Image |
Arguments: -h 64 -s 0 -u p -t 2 -r 2 -c hsl (desaturate background) |
What the script does is as follows:
This is equivalent to the following IM commands for the case of units=percent.
|