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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TImageEnView.IO.CanLoadFile?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
PeterPanino Posted - Jul 02 2021 : 05:01:37
Does TImageEnView.IO have a built-in function CanLoadFile(AFile) or similar that returns True if the file can be loaded in ImageEnView?
5   L A T E S T    R E P L I E S    (Newest First)
PeterPanino Posted - Jul 06 2021 : 09:07:43
Hi Nigel,

thank you!
xequte Posted - Jul 06 2021 : 03:32:05
Hi Peter

These should all return ioUnknown.

attach/xequte/20217633114_UnknownImg.zip
239.89 KB

Nigel
Xequte Software
www.imageen.com
PeterPanino Posted - Jul 03 2021 : 04:06:51
Hi Nigel,

do you have some of those "unloadable" example files (reported as ioUnknown), so I can experiment with them?
xequte Posted - Jul 03 2021 : 00:46:57
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
PeterPanino Posted - Jul 02 2021 : 05:49:18
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;