Use the tbdbitmapdata object to find the differences between the two images. From the upper right corner, use the double-layer loop to traverse all the pixel points on the two images and compare them with each other. IncompleteCodeAs follows:
Procedure tform1.button5click (Sender: tobject );
VaR
BMP 1, BMP 2: tbdbitmapdata;
Left, top: integer;
Isexit: Boolean;
Begin
BMP 1: = tbdbitmapdata. Create;
BMP 2: = tbdbitmapdata. Create;
BMP 1.loadfromfile ('file name 1 ');
BMP 2.loadfromfile ('file name 2 ');
// Assume that the two images are the same size.
Isexit: = false;
For top: = 0 to BMP 1.height-1 do
Begin
For left: = 0 to BMP 1.width-1 do
Begin
If BMP 1 [left, top] <> BMP 2 [left, top] Then
Begin
// The two images are different at the (left, top) position.
// Processing...
If {if you do not continue searching for other differences} Then
Begin
Isexit: = true; // used to exit the loop
Break;
End;
End;
End;
If isexit then break;
End;
BMP 1.free;
BMP 2.free;
End;
The above code is incomplete and can be modified as needed. For details about how to use tbdbitmapdata, refer to: full screen quick image color search in Delphi.