function SaveToFile(const FileName: string; ImageFormat: TIOFileType = ioUnknown): boolean;
Description
Save an image to file (including all its frames) to any format supported by the TImageEnMIO class.
You can specify the image format, or it can be ioUnknown and the type will be determined by the file extension (e.g. ioTIFF for 'Image.tiff')
Returns true on success.
Note: For legacy reasons, SaveToFile() is an alias of Write()
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;
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;