Image.promoteColor Method

Increases the color depth of the image.

Syntax

public int promoteColor(int noOfColorBits)

Run On

Client

Parameters

  • noOfColorBits
    Type: int
    The number of bits that you want to promote the image to.

Return Value

Type: int
0 indicates success; otherwise, failure.

Remarks

The method promotes:

  • 8-bit images to 24 or 32 bits.

  • 4-bit images to 8, 24, or 32 bits.

  • 1-bit images to 4, 8, 24, or 32 bits.

Examples

The following example increases the color depth of an image to 8 bits per pixel, unless it is already 8 or more.

Image img = new Image(); 
 
img.loadFile(@'C:\test.bmp'); 
if (conpeek(img.imageInfo(),3) <8) 
{ 
    img.promoteColor(8); 
}

See Also

Image Class

Image.reduceColorOctree Method