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

PeterPanino

920 Posts

Posted - Apr 12 2015 :  14:37:48  Show Profile  Reply
Hi! If I load an image with:

ImageEn1.IO.LoadFromFileAuto(UnknownImage);


how can I detect the TIOFileType from ImageEn1 and from that the correct file extension, so I can save it with:

SaveToFile(MyFileName + DetectedFileExtension, DetectedImageFormat);

w2m

USA
1990 Posts

Posted - Apr 12 2015 :  15:03:40  Show Profile  Reply
You can get the file type from imageenio.Params or from imageenio.FindFileFormat.
var
iIOFileType: TIOFileType;
iExtension: string;
begin
  iIOFileType := FindFileFormat('C:\myfile.dat', false);
  or
  iIOFileType := ImageEnView1.IO.Params.FileType;

  case iIOFileType of
    ioJPEG: iExtension := '.jpg';
    ioPNG: iExtension := '.png';
  ...
  end;
end;


Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

PeterPanino

920 Posts

Posted - Apr 12 2015 :  15:47:01  Show Profile  Reply
Thanks, much appreciated.
Go to Top of Page

xequte

38510 Posts

Posted - Apr 13 2015 :  02:20:37  Show Profile  Reply
Hi

There is a helper function now too.

Also, assuming you have already loaded an image into ImageEnView then IO.Params.FileType will return the type.

sNewExt := IEFileFormatGetInfo( ImageEnView1.IO.Params.FileType ).SuitableExtension;


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