Fred's ImageMagick Scripts
|
Stretches the channels of an image to full black and white according to a clip amount on each end of the histogram. |
last modified: October 17, 2008
|
USAGE: clip [-c colormode] [-l cliplow] [-h cliphigh] infile outfile
-c .... colormode ....... colorspace/channels in which to stretch/clip PURPOSE: To stretch the channels of an image to full black and white according to a clip amount on each end of the histogram. DESCRIPTION: CLIP stretches the channels of an image to full black and white according to a clip amount on each end of the histogram. The clip amount can be expressed in histogram counts or percent counts. Then the corresponding graylevels are used for the stretch. If the clip amount on both ends is zero, then the stretch will be performed from the channel minimum and maximum graylevel. The clip/stretch operation can be performed on various channel combinations. The choices are: intensity, red/green/blue, saturation/brightness and saturation/lightness. ARGUMENTS: -c colormode ... COLORMODE is the colorspace/channels in which to perform the clip/stretch. The choices are: i (for intensity), rgb, sb (for saturation/brightness) and sl (for saturation/lightness). The stretch will be performed on each channel independently. The default=i. -l cliplow ... CLIPLOW is the count or percent at the low end of the histogram whose corresponding graylevel will be stretch to full black. Values for percent are floats between 0% and 100%. Values for count are integers between 0 and quantumrange for your Q level (e.g. 255 for Q8 and 65535 for Q16). NOTE: counts may only be used for IM 6.4.4-9 or higher. If cliplow=cliphigh=0 or 0%, then the stretch will locate the minimum value in the channel histogram. The default=0.1% -l cliphigh ... CLIPHIGH is the count or percent at the high end of the histogram whose corresponding graylevel will be stretch to full white. Values for percent are floats between 0% and 100%. Values for count are integers between 0 and quantumrange for your Q level (e.g. 255 for Q8 and 65535 for Q16). NOTE: counts may only be used for IM 6.4.4-9 or higher. If cliplow=cliphigh=0 or 0%, then the stretch will locate the minimum value in the channel histogram. The default=0.1% NOTE: The use of counts is limiting. For example, a 400x250 pixel image contains 100,000 pixels. The maximum clip on a Q8 system would be 255 counts. In percent, this is equivalent to 0.255%. Similarly the maximum clip on a Q16 system would be 65535 counts. In percent, this is equivalent to 65.535% which is much more reasonable. However, for a 1000x1000 image containing 1,000,000 pixels, the maximum clip in percent becomes only 6.5535%. 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 Colormode And Clip Amounts |
||||
|
Original Image |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
|
|
|
|
|
|
Original Image |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
|
|
|
|
|
|
Original Image |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
|
|
|
|
|
|
Variations In Colormode And Clip Amounts |
||||
|
Original Image |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
|
|
|
|
|
|
Original Image |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
|
|
|
|
|
|
Original Image |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
|
|
|
|
|
|
Variations In Colormode And Clip Amounts |
||||
|
Original Image |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
|
|
|
|
|
|
Original Image |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
|
|
|
|
|
|
Original Image |
Arguments: |
Arguments: |
Arguments: |
Arguments: |
|
|
|
|
|
|
What the script does is as follows:
This is equivalent to the following IM commands for colormode=sl and cliplow=cliphigh=0.1%
|