ImageEn, unit iemio

TImageEnMIO.SaveToFile

TImageEnMIO.SaveToFile


Declaration

procedure SaveToFile(const FileName: string; FileFormat: TIOFileType = ioUnknown; SelectedOnly: Boolean = False);


Description

Save all images in the attached TImageEnMView or TIEMultiBitmap to a multi-image format: GIF, TIFF, DCX, ICO, AVI, DICOM, PDF or PS.
If FileFormat is ioUnknown, the format is detected from the extension. If the extension is not valid, the image type of the first frame is used. Otherwise, specify a multi-frame file format, which should be one of: ioGIF, ioTIFF, ioPS, ioPDF, ioDICOM, ioDCX, ioICO.
If SelectedOnly = True and the component is attached to a TImageEnMView then only the selected images are output to file.

Note:
Only multi-frame formats are supported. Saving to a single frame format, such as JPEG, will result in an error (Aborting will return true). To save single frames of a TImageEnMView you can use SaveToFile for the relevant frame.
If an internal save error is encountered Aborting will return true. Saving issues due to insufficient write permissions and disk write failures will raise an exception.
To abort while saving set Aborting to true

ImageEn supports saving of multiple frames to GIF, TIFF, AVI, DCX, DICOM, ICO, PDF and PS formats.


Examples

// Save all images in the control as a single TIFF file (which will have as many frames as images in the control)
ImageEnMView1.MIO.SaveToFile( 'C:\Images.tiff' );

// Save only checked images
wasMS := ImageEnMView1.EnableMultiSelect;
try
  ImageEnMView1.LockUpdate();
  ImageEnMView1.EnableMultiSelect := True;

  ImageEnMView1.Deselect();
  ImageEnMView1.BeginSelectImages();
  for i := 0 to ImageEnMView1.ImageCount - 1 do
    if ImageEnMView1.Checked[i] then
      ImageEnMView1.SelectedImage := i;
  ImageEnMView1.EndSelectImages();

  ImageEnMView1.MIO.SaveToFile( 'C:\Images.tiff', ioUnknown, True );

finally
  ImageEnMView1.EnableMultiSelect := wasMS;
  ImageEnMView1.UnlockUpdate();
end;