ImageEn, unit imageenproc

TImageEnProc.CalcImageNumColors

TImageEnProc.CalcImageNumColors


Declaration

function CalcImageNumColors(): Integer;


Description

Return the number of colors found in the current image. This value is not constrained by the internal format of the image (e.g. a 24 bit image doesn't necessarily have 16 million colors).

Note: If the image PixelFormat is not ie1g or ie24RGB, it will be converted


Demos

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr
Demo  Demos\ImageEditing\CompleteEditor\PhotoEn.dpr


Example

// Load test image
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );

  

// Return the number of colors found in the image
n := ImageEnView1.Proc.CalcImageNumColors();
s := format( 'Color count: %d', [ n ]);

ImageTest1.jpg: Color count: 62008
ImageTest2.jpg: Color count: 15910
ImageTest3.jpg: Color count: 21283