ImageEn, unit imageenproc

TImageEnProc.CalcAverageRGB

TImageEnProc.CalcAverageRGB


Declaration

function CalcAverageRGB(SampleCount : Integer = 0): TRGB;


Description

Return the average RGB values of the selection.

If iSampleCount < 1 then the entire image is analyzed. To speed up processing you can sample a smaller number of points, e.g. 100.

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


Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Example

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

  

// Return the average RGB values of the selection (with sample size of 100)
rgb := ImageEnView1.Proc.CalcAverageRGB( 100 );
s := format( 'Average RGB: %d, %d, %d', [ rgb.r, rgb.g, rgb.b ]);

ImageTest1.jpg: Average RGB: 138, 106, 86
ImageTest2.jpg: Average RGB: 245, 218, 144
ImageTest3.jpg: Average RGB: 102, 91, 82