Jaa


Image.promoteColor(Int32) Method

Definition

Increases the color depth of the image.

public:
 virtual int promoteColor(int _noOfColorBits);
public virtual int promoteColor (int _noOfColorBits);
abstract member promoteColor : int -> int
override this.promoteColor : int -> int
Public Overridable Function promoteColor (_noOfColorBits As Integer) As Integer

Parameters

_noOfColorBits
Int32

The number of bits that you want to promote the image to.

Returns

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.

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

Applies to