I wrote this function to save me from trying in vain to load false DICOM files with the *.DIC extension, as this extension is also a popular extension for DICTIONARY files:
function IsKnownImageFileByContent(const AFile: string): Boolean;
{ checks the CONTENT of the passed file, if it is really a known image file }
begin
Result := False;
var ThisContentFormat := iexBitmaps.FindFileFormat(AFile, ffContentOnly);
if ThisContentFormat <> hyieutils.ioUnknown then
Result := True;
end;
Question: is there a better (i.e., more efficient or shorter) function for this purpose in the ImageEn library?