program new;
const
  bmppath = 'C:\Carina_1_by_Eeitam.png';
var
   p1, p2: TPointArray;
   w, h: integer;
   i, col: integer;
   bmp: integer;

begin
  SetColorToleranceSpeed(2);
  bmp := LoadBitmap(bmppath);
  SetTargetBitmap(bmp);
  GetClientDimensions(W, H);
  writeln(inttostr(w) + ' : ' + inttostr(h));

  for i := 0 to 100 do
  begin
    col := Random(clWhite);
    writeln(inttostr(col));
    FindColorsTolerance(p1, col, 0, 0, W - 1, H - 1, 40);
    FindColorsToleranceOptimised(p2, col, 0, 0, W - 1, H - 1, 40);
    writeln(inttostr(length(p1)) + ' : ' + inttostr(length(p2)));
    if(length(p1) <> length(p2)) then
      writeln('wat!');

    setlength(p1,0);
    setlength(p2,0);

  end;

  FreeBitmap(bmp);
end.
