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. |
Converts an image to binary using range values for each channel of the input. |
last modified: August 16, 2019
USAGE: rangethresh [-r redrange] [-g greenrange] [-b bluerange] [-u units]
[-c colorspace] infile outfile
-r ... redrange ..... range values for the red channel expressed as a comma separated PURPOSE: To convert an image to binary using range values for each channel of the input. DESCRIPTION: RANGETHRESH converts an image to binary using range values for each channel of the input. This script only works for 3-channel color images, not single channel grayscale images. ARGUMENTS: -r redrange ... REDRANGE is the range values for the red channel expressed as a comma separated pair of numbers "low,high". Values can be expressed in range 0 to 255 or range 0 to 100 depending upon the units argument. Values are 0<=float<=255; The default="0,255". (no spaces) -g greenrange ... GREENRANGE is the range values for the red channel expressed as a comma separated pair of numbers "low,high". Values can be expressed in range 0 to 255 or range 0 to 100 depending upon the units argument. Values are 0<=float<=255; The default="0,255". (no spaces) -b bluerange ... BLUERANGE is the range values for the red channel expressed as a comma separated pair of numbers "low,high". Values can be expressed in range 0 to 255 or range 0 to 100 depending upon the units argument. Values are 0<=float<=255; The default="0,255". (no spaces) -u units ... UNITS for the ranges. The choices are: 8bit (8) or percent (p). The default="8bit". -c colorspace ... COLORSPACE in which to process the image. Any valid 3-channel Imagemagick colorspace is allowed. The default=sRGB. Note that range values must correspond to the channels of the colorspace. REQUIREMENTS: This script only works for 3-channel color images, not single channel grayscale images. For grayscale images, use the Imagemagick 7 -range-threshold. 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. |
Original Image |
arguments: |
What the script does is as follows:
This is equivalent to the following IM commands for the case of
|