Syntax
Document.Stretch ( Type, Gamma, OutputRange, InputRange [, Min, Max ])
Parameters
StretchType Type - specifies the type of image stretch to be performed
mxLinearStretch (0) : Linear, useful for matching the image to a specific numerical range, e.g., for a particular file format
mxLogarithmicStretch (1) : Logarithmic, compressing the images's dynamic range
mxGammaStretch (2) : Gamma, selectively emphasizing faint or bright details
Float Gamma - specifies how Gamma Stretching will affect the image
StretchOutputType OutputRange - specifies the numerical range of the stretch image
mx8BitOR (0) : scale to fit in 1 byte/pixel (256 levels)
mx12BitOR (1) : scale to fit in 12 bits/pixel (4096 levels)
mx16BitOR (2) : scale to fit in 2 bytes/pixel (65536 levels)
mxUnlimitedOR (3) : no scaling is applied after the stretch, so that image pixels can have any non-negative value
StretchInputType InputRange - specifies how the minimum and maximum input pixel values for the stretch operation are established
mxMaxPixelIR (0) : the faintest and brightest pixel in the image
mxScreenIR (1) : the current Minimum and Maximum settings in the Screen Stretch window
mxManualIR (2) : from parameters Min and Max
Float Min - [optional] the minimum pixel value to be stretched
Float Max - [optional] the maximum pixel value to be stretched
Returns
Nothing
Remarks
Modifies pixel values in the image according to one of three types of scaling. Linear stretching transforms the "minimum" pixel to zero, the "maximum" pixel to the greatest value representable in the selected output range, and intermediate pixels to intermediate values in a linear fashion. Logarithmic stretching greatly exaggerates differences at the dark end of the image. Gamma stretching is another non-linear stretch that allows control over whether faint (parameter Gamma < 1) or bright (Gamma > 1) details are enhanced.
The desired range of the stretched image is specified using OutputRange. The range of pixels to be stretched is specified using InputRange and, if "manual" mode is selected, the parameters Min and Max. Pixels fainter than the minimum (whether this value is copied from the Screen Stretch window or given explicitly) become zero in the resulting image. Pixels brighter than the maximum are mapped to the same value as the maximum.
This method is equivalent to the Stretch command.