ImageEn, unit iemio




function LoadFromFile(const FileName: string; bCheckUnknown: Boolean = False): Boolean; overload;
function LoadFromFile(const FileName: string; FileFormat: TIOFileType): Boolean; overload;


Load a multi-image file into the attached TImageEnMView or TIEMultiBitmap.
With first overload the format is detected from the filename extension (e.g. ".gif" files will be loaded as GIF). With second, you can force loading of the file as a specific type.

FileName is the file name including extension.
FileFormat specifies the image format. If specified as ioUnknown, it will use the file's extension.
bCheckUnknown if the file extension is not known or is incorrect (e.g. a GIF file named MyImage.jpg), then loading will be attempted by analyzing the file content (in the same way as LoadFromFileAuto)

Result will be false if the file is not a recognized file type (Aborting will be true). Loading errors due to a file not being available will raise an exception.
However, if you set bCheckUnknown to true, ImageEn will try to load the file even if it has an unknown or incorrect file extension.

ImageEn supports loading of multiple frames from GIF, TIFF, AVI, DCX, DICOM, ICO and CUR formats. Loading of PDF format is also supported if a relevant plug-in is installed.

Note: Existing content is not cleared. Call Clear to remove existing content before loading.


// Load an AVI into our TImageEnMView

// Load a file (which is probably a TIFF but may have the wrong extension)
ImageEnMView1.MIO.LoadFromFile('C:\pages.tiff', True);

// Show an error on load failure
if ImageEnMView1.MIO.LoadFromFile(sFilename) = False then
  ShowMessage('This is not a supported file type');

// Load file as a .GIF
ImageEnMView1.MIO.LoadFromFile('C:\', ioGIF);

See Also

- LoadFromFileAuto