ImageEn, unit imageenproc

TImageEnProc.ConvertToPalette

TImageEnProc.ConvertToPalette

Declaration

procedure ConvertToPalette(NumColors: Integer; OutPalette: Pointer = nil; DitherMethod: TIEDitherMethod = ieOrdered);

Description

Reduces the number of colors in the image to NumColor value and fills the Palette array with the color map used for color reduction.
DitherMethod specifies how to convert a color image to black & white. It can be ieOrdered or ieThreshold. It is not used for other color conversions.

Note:
If a palette is not required, use ConvertTo
Any selection is ignored. The whole image is converted to the specified palette
A quantizer is used to reduce the number of colors using the method specified by ColorReductionAlgorithm
If the image PixelFormat is not ie24RGB or ie32RGB, it will be converted
The alpha channel is maintained when converting

Examples

ImageEnView1.IO.LoadFromFile( 'D:\TestSource.jpg' );




ImageEnView1.Proc.ConvertToPalette( 16 );




// Convert to 256 colors and return the new palette
var
  Palette: array [0..255] of TRGB;
begin
  ImageEnView1.Proc.ConvertToPalette(256, @Palette[0], ieOrdered);
...
end;

See Also

ConvertTo