There's probably a simpler method, but you could load the files into memory and compare them.
function CompareImages(Filename1,Filename2 : string): boolean;
var
S1,S2 : TMemoryStream;
P1,P2 : Pointer;
Match : boolean;
begin
S1 := TMemoryStream.Create;
S2 := TMemoryStream.Create...