Contrast and Brightness Alteration

 

Use ColorBrightnessContrast function or method from BiImage DLL or OCX to change the brightness and contrast of an image. If you use the BiDlgs DLL or OCX you can display a common dialog to specify the new contrast and brightness values.

 

[C++]

 

/* Adjust the Brightness and Contrast of an image*/

 

#include “BiImage.h”

 

HDIB hDibNew;

 

/* 1. parameter: Handle of the DIB to change

   2. parameter: New value of brightness

   3. parameter: New value of contrast

   4. parameter: Display dialog            */

 

hDibNew = ColorBrightnessContrast(hDib, 0, 0, TRUE);

 

if (!hDibNew)

{

            // Error

}

 

[C#]

 

/* Adjust the Brightness and Contrast of an image*/

 

long hDibNew;

 

/* 1. parameter: Handle of the DIB to change

   2. parameter: New value of brightness

   3. parameter: New value of contrast

   4. parameter: Display dialog */

 

hDibNew = BiImage.ColorBrightnessContrast(hDib, 0, 0,

true);

 

if (hDibNew == 0)

{

            // Error

}