TImageEnIO.ParamsFromFile
Declaration
function ParamsFromFile(const FileName: WideString; UseExtension: Boolean = False): Boolean; overload;
function ParamsFromFile(const FileName: WideString; FileType: TIOFileType): Boolean; overload;
Description
Reads the
image properties and meta-data without loading the image (and without changing the current image).
Result is False if a loading error is encountered due to a corrupt or unknown image format.
ParamsFromFile is the same as calling
LoadFromFile but without retrieving the image.
| Parameter | Description |
| FileName | File name with full path |
| FileType | Specifies the file format of the image. If ioUnknown is specified, the format is detected automatically by reading the image header (using FindStreamFormat) |
| UseExtension | If True, the file format is based on the extension of the file, e.g. image.jpeg will be processed as ioJPEG |
Note: You do NOT need to call ParamsFromFile if you are already loading the image, e.g. using
LoadFromFile
Examples
// Load the parameters of an image (which may be a BMP file, but we will examine the content to be sure)
ImageEnView1.IO.ParamsFromFile( 'C:\alfa.bmp' );
Label1.Caption := 'alfa.bmp has ' + IntToStr(ImageEnView1.IO.Params.BitsPerSample) + ' bits per sample';
// Load the parameters of a BMP
ImageEnView1.IO.ParamsFromFile( 'C:\alfa.bmp', ioBMP );
Label1.Caption := 'alfa.bmp has ' + IntToStr(ImageEnView1.IO.Params.BitsPerSample) + ' bits per sample';
// Load the parameters of a file. It will be assumed to a BMP because of the file extension
ImageEnView1.IO.ParamsFromFile( 'C:\alfa.bmp', True );
Label1.Caption := 'alfa.bmp has ' + IntToStr(ImageEnView1.IO.Params.BitsPerSample) + ' bits per sample';
// Show the EXIF date of an image
io := TImageEnIO.Create( nil );
try
io.ParamsFromFile( Filename );
ShowMessage( DateTimeToStr(( io.IOParams.EXIF_DateTimeOriginal2 ));
finally
io.Free();
end;