Image.promoteColor Method [AX 2012]

Increases the color depth of the image.

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.

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.

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); 
}

Community Additions

ADD
Show: