procedure tform1.button1click(sender: tobject);
var
b1, b2: tbitmap;
c1, c2: pbyte;
x, y, i,
different: integer; // counter for different pixels
begin
b1 := image1.picture.bitmap;
b2 := image2.picture.bitmap;
assert(b1.pixelformat = b2.pixelformat); // they have to be equal
different := 0;
for y := 0 to b1.height - 1 do
begin
c1 := b1.scanline[y];
c2 := b2.scanline[y];
for x := 0 to b1.width - 1 do
for i := 0 to bytesperpixel - 1 do // 1, to 4, dep. on pixelformat
begin
inc(different, integer(c1^ <> c2^));
inc(c1);
inc(c2);
end;
end;
end;
|