ImageEn, unit iexHelperFunctions

TImageEnIO.LoadFromFileAutoEx

TImageEnIO.LoadFromFileAutoEx


Declaration


function LoadFromFileAutoEx(const sFilename: string; bAutoAdjustOrientation: Boolean; iImageIndex : Integer = -1): Boolean;


Description


A modified version of LoadFromFileEx that copes with image files with a incorrect extension (e.g. a GIF file named MyImage.jpg).

This function will attempt to load the file using its extension (using LoadFromFile) but on failure will examine the message content to determine its type (i.e. falling back to LoadFromFileAuto).

Optionally it will set EnableAdjustOrientation to automatically re-orient JPEG camera images and ImageIndex to display a specific image.
Returns True if loading was successful, or False on error (i.e. the file could not be loaded even by examining its content).


Example


// Load MyImage.tiff (even if it is a JPEG or GIF)
ImageEnView1.IO.LoadFromFileAutoEx('D:\MyImage.tiff');