VAR
Histogram : THistogram;
i : INTEGER;
j : INTEGER;
Row : pByteArray;

FOR i := Low( THistogram ) TO High( THistogram ) DO
ĦĦĦĦHistogram[ i ] := 0;

IF Bitmap.PixelFormat = pf8bit THEN
BEGIN
  FOR j := Bitmap.Height - 1 DOWNTO 0 DO
  BEGIN
    Row := pByteArray( Bitmap.Scanline[ j ] );
    FOR i := Bitmap.Width - 1 DOWNTO 0 DO
    BEGIN
      INC( Histogram[ Row[ i ] ] )
    END
  END
END



