Red-eye reduction in Visual Basic using the csXImage control.

The "Red-Eye" effect spoils many otherwise perfect photos. Even though digital cameras usually have a flash setting that prevents red-eye, how often do we forget to select that option?

Removing the red glare from the eye is very simple in applications that use csXImage. The method is demonstrated in the Visual Basic demo program supplied in the csXImage download.

The photo is corrected in two steps.

(1) A region around the eye, usually an ellipse or a circle, is selected. This requires just one line of code.


(2) After the user completes the selection using the mouse, two further lines of code adjust the red intensity for pixels where it is the dominant colour.

ImageBox1.UseSelection = True

The result is shown below.

ActiveX loading a photograph in VB

Original photo

ActiveX selecting an image area in VB

Selecting the red-eye

ActiveX removing red eye in a VB image

The final result

<<Previous page