Color Reduction (Scaling down the number of bits)

 

There are many functions to dither images to 8, 4 or 1 bit per pixel. The differences between color reduction functions are the different error-diffusion algorithms.

Available Functions/Methods:

 

The DitherOrdered function always dithers to monochrome (1 bit).

 

Use the Convert32BitDIBTo24Bit function (method) for converting 32 bit per pixel images to 24 bit per pixel.

 

[C++]

 

/* Color Reduction*/

 

#include “BiImage.h”

 

HDIB hDibNew;

 

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

   2. parameter: Dithering to 8 bit */

 

hDibNew = DitherFS4(hDib, 8);

 

if (!hDibNew)

{

            // Error

}

 

[VB]

 

‘ Color Reduction

 

Dim hDibNew as Long

Dim BIImageObj As Object

 

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

 

‘ 1. parameter: Handle of the DIB to dither

‘ 2. parameter: Dithering to 8 bit

 

hDibnew = BIImageObj.DitherFS4(hDib, 8)

 

Set BIImageObj = Nothing

 

If hDibNew = 0 Then

            ‘ Error

End If

 

[C#]

 

/* Color Reduction*/

 

int hDibNew;

 

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

   2. parameter: Dithering to 8 bit */

 

hDibNew = BiImage.DitherFS4(hDib, 8);

 

if (hDibNew == 0)

{

            // Error

}