ImageGear Professional for Windows ActiveX
AdjustContrast Method

Description:

Allows the brightness and contrast of the image to be adjusted. Brightness and contrast are linear controls that affect the intensity of the image pixels. These controls are similar to the Brightness and Contrast controls on a typical television set.

Contrast is a multiplier and Brightness is an additive value. A Contrast of 2.0 will cause each pixel to take on twice the intensity that it originally had while 0.5 will divide each by 2. A Brightness value of 20.0 will cause each pixel's intensity to be increased by 20 and a -20 will decrease or darken each by 20. Pixel values are clipped to the 0 to 255 range. Once clipped the data is lost and can not be regenerated. A Brightness of 0.0 and a Contrast of 1.0 will cause no change to the image. A -1.0 Contrast with a Brightness of 0.0 can be used to invert the intensity range.

For 8-bit grayscale images there are 2 methods that can be used to adjust the contrast. The adjustment can be made to the actual pixel value or to the palette. Use ContrastOptions.Mode to determine which. For 4-bit and 8i images the contrast can only be applied to the palette and ContrastOptions.Mode is ignored. For 24-bit images the contrast can only be applied to the pixel values themselves since there is no palette.

This method takes into account the ROI settings of pPage object, that are accessible via the IGPage Object.ROI Property. By default ROI is set to the entire image.

Syntax:

      AdjustContrast (ByVal pPage As IGPage, ByVal Contrast As Double,
ByVal Brightness As Double, ByVal Gamma As Double)

Parameters:

Name Description
pPage Reference to IGPage Object to which the contrast adjustment is applied.
Contrast The range should be from -(2^bpc) to (2^bpc) to adjust the contrast, bpc being equal to the bits per channel. Here are two examples of how this works:
  • A normal RGB image, 8bpc, would be -(2^8) to (2^8), or -256 to 256.
  • A 4 bit indexed image, 4bpc, would be -(2^4) to (2^4), or -16 to 16.
Brightness The range should be from -(2^bpc)+1 to (2^bpc)-1 to adjust the brightness, bpc being equal to the bits per channel. Here are two examples of how this works:
  • A normal RGB image, 8bpc, would be -(2^8)+1 to (2^8)-1, or -255 to 255.
  • A 4 bit indexed image, 4bpc, would be -(2^4)+1 to (2^4)-1, or -15 to 15.
Gamma Greater than 0.0. Usual range: 0.75 to 3.0

Return Value:

N/A

Bits Per Pixel:

All

Sample:

Image Processing and Effects.

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback