ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TImageEnView.IO.CanLoadFile?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

862 Posts

Posted - Jul 02 2021 :  05:01:37  Show Profile  Reply
Does TImageEnView.IO have a built-in function CanLoadFile(AFile) or similar that returns True if the file can be loaded in ImageEnView?

PeterPanino

862 Posts

Posted - Jul 02 2021 :  05:49:18  Show Profile  Reply
Is this the most efficient simulation of such a function?:

function TformMain.ImageFileCanBeLoaded(const aFilePath: string): Boolean;
begin
  Result := iexBitmaps.FindFileFormat(aFilePath, ffFallbackToExtension) <> ioUnknown;
end;
Go to Top of Page

xequte

38191 Posts

Posted - Jul 03 2021 :  00:46:57  Show Profile  Reply
Yes, though the risk with ffFallbackToExtension is that a file that has an invalid extension (such as a text file with a .JPEG extension) will be reported as loadable (ioJPEG).

If you use ffContentOnly:

Result := iexBitmaps.FindFileFormat(aFilePath, ffContentOnly) <> ioUnknown;

Then the file is almost certainly loadable by ImageEn (though there will be a small number of file types like some DICOM that will be reported as ioUnknown, but are actually loadable).



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

862 Posts

Posted - Jul 03 2021 :  04:06:51  Show Profile  Reply
Hi Nigel,

do you have some of those "unloadable" example files (reported as ioUnknown), so I can experiment with them?
Go to Top of Page

xequte

38191 Posts

Posted - Jul 06 2021 :  03:32:05  Show Profile  Reply
Hi Peter

These should all return ioUnknown.

attach/xequte/20217633114_UnknownImg.zip
239.89 KB

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

862 Posts

Posted - Jul 06 2021 :  09:07:43  Show Profile  Reply
Hi Nigel,

thank you!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: