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
 IsFileExtensionSupported?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

862 Posts

Posted - Apr 15 2024 :  01:39:58  Show Profile  Reply
I have found no method to detect if a specific FILE EXTENSION can be loaded in TImageEnView, for example:

ImageEnView1.IsFileExtensionSupported('.UnknownExtension');


So, as a workaround, I use this function:

function CanLoadImage(const FileName: string): Boolean;
var
  ImageEnIO: TImageEnIO;
begin
  Result := True;
  ImageEnIO := TImageEnIO.Create(nil);
  try
    try
      ImageEnIO.LoadFromFileAuto(FileName);
    except
      on E: Exception do
        Result := False;
    end;
  finally
    ImageEnIO.Free;
  end;
end;


Is there a built-in method for this?

xequte

38189 Posts

Posted - Apr 15 2024 :  04:31:25  Show Profile  Reply
Yes, you can use:

http://www.imageen.com/help/IEFilenameToFileFormat.html

The result will not be ioUnknown if the format is supported.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: