ImageEn, unit iexBitmaps

TIEMultiBitmap.Read

TIEMultiBitmap.Read


Declaration

function Read(const FileName: string; IOParams: TIOMultiParams = nil; bCheckUnknown: Boolean = False; OnDemand: Boolean = False): boolean; overload;
function Read(Stream: TStream; FileType: TIOFileType = ioUnknown; IOParams: TIOMultiParams = nil): boolean; overload;
function Read(Buffer: pointer; BufferSize: integer; FileType: TIOFileType = ioUnknown; IOParams: TIOMultiParams = nil): boolean;


Description

Load an image from file or stream (including all its frames). This method supports all formats supported by TImageEnMIO class.
When reading from a stream you can optionally specify the Format. If it is not specified ImageEn will determine the file type automatically.
You can optionally pass a TIOMultiParams object for the I/O parameters of the file (see also ParamsEnabled). 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 Read in IsVirtual mode.


Examples

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

...which is the same as:
with TIEMultiBitmap.Create('input.tiff') do
begin
  Write('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.Read( '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.Read( 'D:\multi.pdf' );
mbmp.Params[0].TIFF_Compression := ioTIFF_LZW;
mbmp.DuplicateCompressionInfo();
mbmp.Write( 'D:\Converted.TIFF' );
mbmp.Free;


See Also

 Write