ImageEn, unit iexBitmaps

TIEMultiBitmap.LoadFromFile

TIEMultiBitmap.LoadFromFile


Declaration

function LoadFromFile(const FileName: string; bCheckUnknown: Boolean = False; OnDemand: Boolean = False): boolean;


Description

Load an image from file (including all its frames) of any format supported by the TImageEnMIO class.
If bCheckUnknown is true and 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).
If OnDemand=True, loading of each frame is delayed until it is needed. This is useful if you are displaying or analyzing a few pages only.

Returns False on failure.

Note:
 Do not use LoadFromFile() in IsVirtual mode
 For legacy reasons, LoadFromFile() is an alias of Read()


Examples

var
  mbmp: TIEMultiBitmap;
begin
  mbmp := TIEMultiBitmap.Create;
  mbmp.LoadFromFile('input.tiff');
  mbmp.SaveToFile('output.tiff');
  mbmp.Free;
end;

...which is the same as:
with TIEMultiBitmap.Create('input.tiff') do
begin
  SaveToFile('output.tiff');
  Free;
end;

...And the same as:
var
  mbmp: TIEMultiBitmap;
  mio: TImageEnMIO;
begin
  mbmp := TIEMultiBitmap.Create;
  mio := TImageEnMIO.CreateFromIEMBitmap(mbmp);
  mio.LoadFromFile('input.tiff');
  mio.SaveToFile('output.tiff');
  mio.Free;
  mbmp.Free;
end;

// Loading a TIFF on demand
// Useful if we are only going to view or analyze a few frames. Not useful if we will save the whole file
var
  mbmp: TIEMultiBitmap;
begin
  mbmp := TIEMultiBitmap.Create;
  mbmp.LoadFromFile( 'input.tiff', nil, False, True );
  // do something with some frames
  mbmp.Free;
end;

// Convert a multi-page PDF file to TIFF
// Ensure iepdf32.dll is in the EXE folder
mbmp := TIEMultiBitmap.Create();
mbmp.LoadFromFile( 'D:\multi.pdf' );
mbmp.Params[0].TIFF_Compression := ioTIFF_LZW;
mbmp.DuplicateCompressionInfo();
mbmp.SaveToFile( 'D:\Converted.TIFF' );
mbmp.Free;


See Also

 LoadFromStream
 LoadFromBuffer
 SaveToFile
 MIO