ImageEn, unit iexBitmaps

TIEMultiBitmap.SaveToFile

TIEMultiBitmap.SaveToFile

Declaration

function SaveToFile(const FileName: string; FileType: TIOFileType = ioUnknown): Boolean;

Description

Save an image to file (including all its frames) to any format supported by the TImageEnMIO class.
FileType specifies the image format to save the image. If ioUnknown is specified, the file extension is used to determine the format (e.g. ioGIF for "image.gif")

Returns True on success.

Note:
Alternatively, you can use the saving methods of MIO
For legacy reasons, SaveToFile() is an alias of Write()

Examples

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

Which is the same as...
var
  mbmp: TIEMultiBitmap;
begin
  mbmp := TIEMultiBitmap.Create('input.tiff');
  mbmp.SaveToFile('output.tiff');
  mbmp.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.SaveToFile( '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.SaveToFile( 'D:\Animated.gif' );
mbmp.Free();

See Also

SaveToStream
LoadFromFile
MIO