ImageEn, unit iexBitmaps

TIEMultiBitmap.Write

TIEMultiBitmap.Write


Declaration

function Write(const FileName: string; IOParams: TIOMultiParams = nil): boolean; overload;
function Write(const FileName: string; FileType: TIOFileType; IOParams: TIOMultiParams = nil): boolean; overload;
function Write(Stream: TStream; FileType: TIOFileType; IOParams: TIOMultiParams = nil): boolean; overload;


Description

Write an image to file or stream (including all its frames). This method supports all formats supported by TImageEnMIO class.
If saving to a stream you must specify the FileType. When saving to a file, FileType can be ioUnknown, and the type will be determined by the file extension (e.g. ioTIFF for 'Image.tiff')
You can optionally specify an TIOMultiParams object containing the I/O parameters of the file (see also ParamsEnabled).
Returns true on success.


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;

Also, 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;

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

// Create an animated GIF file from ten source images
mbmp := TIEMultiBitmap.create;
for i := 0 to 9 do
begin
  mbmp.AppendImage( format( 'D:\Source\Frame %d.bmp', [i] ));
  mbmp.Params[i].GIF_DelayTime := 10; // Display each frame for 1/10th of a second
end;
mbmp.Write( 'D:\animated.gif' );
mbmp.Free;