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

}

 

[VB]

 

‘ Adjust the Brightness and Contrast of an image

 

Dim hDibNew as Long

Dim BIImageObj As Object

 

Set BIImageObj = CreateObject("BIIMAGE.BIImageCtrl.1")

 

‘ 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 = BIImageObj.ColorBrightnessContrast(hDib,0, 0, _

True)

 

Set BIImageObj = Nothing

 

If hDibNew = 0 Then

            ‘ Error

End If

 

[C#]

 

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

 

int 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

}