ImageEn, unit imageenio

TImageEnIO.SaveToFileIEN

TImageEnIO.SaveToFileIEN


Declaration

procedure SaveToFileIEN(const FileName: WideString; SelectedOnly: Boolean = False);


Description

Saves the current image in the connected TImageEnView to a file in ImageEn's native format, which preserves the image and any layers.
FileName is the file name including extension.
Specify SelectedOnly to only output the layers that are selected.
Set IEN_Compression to your preferred compression method.


Note:
An exception will be raised if the TImageEnIO is not attached to a TImageEnView
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.
You can also save layers in PSD, PDF and SVG format
To abort while saving set Aborting to true


Examples

// Save current layer configuration (compress images as PNG)
ImageEnView1.IO.Params.IEN_Compression := ioPNG;
ImageEnView1.IO.SaveToFileIEN( 'D:\layers.ien' );

// Load saved layers
ImageEnView1.IO.LoadFromFileIEN( 'D:\layers.ien' );

// Save annotations only (don't include background image or thumbnail)
ImageEnView1.IO.Params.IEN_StoreBackground := False;
IEGlobalSettings().ThumbnailSize := 0;
ImageEnView1.IO.SaveToFile( 'D:\annot.ien' );

// Save the selected layer as a file (that can be imported into other layer sets)
tempView := TImageEnView.Create(nil);
try
  idx := tempView.LayersAdd(ImageEnView1.CurrentLayer);
  // Reset layer position to ensure good preview
  tempView.Layers[idx].PosX := 0;
  tempView.Layers[idx].PosY := 0;
  tempView.IO.Params.IEN_StoreBackground := False;
  tempView.IO.SaveToFileIEN( SelLayerFilename );
finally
  tempView.Free;
end;


// Save the layers of three TImageEnViews to a file
var
  fs: TFileStream;
begin
  fs := TFileStream.Create(FileName, fmCreate);
  ImageEnView1.IO.SaveToStreamIEN( fs );
  ImageEnView2.IO.SaveToStreamIEN( fs );
  ImageEnView3.IO.SaveToStreamIEN( fs );
  FreeAndNil(fs);
end;

// Load the layers
var
  fs: TFileStream;
begin
  fs := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite );
  ImageEnView1.IO.LoadFromStreamIEN( fs );
  ImageEnView2.IO.LoadFromStreamIEN( fs );
  ImageEnView3.IO.LoadFromStreamIEN( fs );
  FreeAndNil(fs);
end;



See Also

IEN_Compression
IEN_Description
IEN_SaveAsVersion
LoadFromFileIEN
SaveToStreamIEN
LayersSaveMergedTo