ImageEn, unit iexBitmaps

TIEBitmap.Write

TIEBitmap.Write


Declaration


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


Description


Writes the image to a file or stream. This method supports all formats supported by TImageEnIO 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. ioJPEG for 'Image.jpeg')
You can optionally specify an TIOParams object containing the I/O parameters of the file (see also ParamsEnabled).
Returns true on success.

Note: TIEBitmap only supports saving of a single frame image. To load and save images containing multiple frames, use TIEMultiBitmap


Examples


var
  bmp: TIEBitmap;
begin
  bmp := TIEBitmap.Create;
  bmp.Read('input.jpg');
  bmp.Write('output.jpg');
  bmp.Free;
end;

Which is the same as...
with TIEBitmap.Create('input.jpg') do
begin
  Write('output.jpg');
  Free;
end;

Also the same as...
var
  bmp: TIEBitmap;
  io: TImageEnIO;
begin
  bmp := TIEBitmap.Create;
  io := TImageEnIO.CreateFromBitmap(bmp);
  io.LoadFromFile('input.jpg');
  io.SaveToFile('output.jpg');
  io.Free;
  bmp.Free;
end;


See Also


- Read
- Filename