ImageGear v26.5 - Updated March 3, 2025
ImageGear.Core Assembly / ImageGear.Processing Namespace / ImGearRasterProcessing Class / StretchContrast Method / StretchContrast(ImGearRasterPage,ImGearContrastModes,ImGearChannelRange) Method
Image to process.
One of the contrast processing modes: ImGearContrastModes.PALETTE, ImGearContrastModes.PIXEL, ImGearContrastModes.AUTO.
Channel range to process.
Example




StretchContrast(ImGearRasterPage,ImGearContrastModes,ImGearChannelRange) Method
Stretches image contrast. Processes specified range of channels.
Syntax
'Declaration
 
Public Overloads Shared Sub StretchContrast( _
   ByVal page As ImGearRasterPage, _
   ByVal mode As ImGearContrastModes, _
   ByVal channels As ImGearChannelRange _
) 
 
'Usage
 
Dim page As ImGearRasterPage
Dim mode As ImGearContrastModes
Dim channels As ImGearChannelRange
 
ImGearRasterProcessing.StretchContrast(page, mode, channels)

Parameters

page
Image to process.
mode
One of the contrast processing modes: ImGearContrastModes.PALETTE, ImGearContrastModes.PIXEL, ImGearContrastModes.AUTO.
channels
Channel range to process.
Remarks
Can be applied only to raster pages with standard (non Run-Ends) DIB.

If ContrastMode is equal to ImGearContrastModes.PALETTE, DIB must have a palette.

Use ImGearRasterProcessingVerifier.CanApplyStretchContrast method to check whether the operation can be performed.

Example
// Channel range to adjust contrast.
ImGearChannelRange igChannelRange = new ImGearChannelRange(0, igRasterPage.DIB.ChannelCount);
// Stretch the contrast.
ImGearRasterProcessing.StretchContrast(igRasterPage,
    ImGearContrastModes.AUTO, igChannelRange);
See Also