For a detailed discussion, and timed comparisons, of ways of comparing two identically sized images ... via byte-by-byte (ints), via md5 (hash), via mask, via calling memcmp function in msvcrt.dll, using lockbits ...
... where you assume no rotation, no flipping, and that both images are in an identical format, for example: Format32bppRgb ... ... complete with C# code ... see: [
^]
Speculation on other issues that may not be relevant to you:
When trying to solve a problem like this, it is helpful to know as much as possible about the possible variance in "content" of whatever it is you are comparing. If the variance can't be predicted at all: your solution must be, of course, more general.
An important aspect in this problem is: whether you are going to have to deal with two pictures
of different sizes that contain the same number of pixels, which may be, possibly, identical, but one picture has been rotated and/or flipped.
Can you expect, now, that by simply looking for differences in image dimensions, you can automatically reject comparing, for example, a 400x300 image with a 300x400 image ? Or do you have to handle those cases ?
The case of comparing two pictures where the total number of pixels match but their relative sizes preclude one being a transformation (rotation, flipping) of the other: do you need to handle such cases ?
So: consider two pictures whose sizes, as in the example above, are not identical but match
if one picture is rotated either 90 or -90 degrees. Do you need to handle such cases ?
And what, if they are the same size, but one image has been flipped 180 degrees horizontally or vertically. What if one has been both rotated and "flipped" ? Do you need to handle such cases ?