var
vergl: array[0..11] of byte =
($FF, $D8, $FF, $E0, 0, $10, $4A, $46, $49, $46, 0, 1);
function isJPEG(Datei: string): boolean;
var
ms: TMemorystream;
begin
result := false;
if not fileexists(datei) then exit;
ms := Tmemorystream.create;
try
ms.loadfromfile(datei);
if ms.size > 11 then
result := comparemem(ms.memory, @vergl, 12);
finally
ms.free;
end;
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
if isJPEG('c:\test.jpg')
then showmessage('Ja')
else showmessage('Nein')
end;