ImageEn, unit imageenio

TImageEnIO.LoadFromFileIEN

TImageEnIO.LoadFromFileIEN


Declaration

function LoadFromFileIEN(const FileName: WideString; Append: Boolean = False): Boolean;


Description

Loads an image from an ImageEn's native image format, which preserves the image and any layers.

FileName is the file name including extension. Result will be false if the file is not ImageEn format (and Aborting will be true). Loading errors due to a file not being available will raise an exception.
If Append is True, the existing content is not cleared, i.e. layers in this file will be added to existing layers.

Note:
 You can abort loading by setting Aborting to true
 If the TImageEnIO is attached to a TImageEnView then layers in the file will be loaded, if it is attached to a TIEBitmap or TBitmap then the file will be loaded as a merged image.
 You can also load layers with the PSD format and import layers from PDF files


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' );

// Append layers from a file, except the background layer
ImageEnView1.LockUpdate();
cnt := ImageEnView1.LayersCount;
ImageEnView1.IO.LoadFromFileIEN( 'D:\layers.ien', True );
ImageEnView1.LayersRemove( cnt );
ImageEnView1.UnlockUpdate();

// Load a background image, and add annotations from a layer file (except background or other image layers)
ImageEnView1.LockUpdate();
ImageEnView1.IO.LoadFromFile( 'D:\Background.jpg', True );
ImageEnView1.IO.LoadFromFileIEN( 'D:\layers.ien' );
for I := ImageEnView1.LayersCount - 1 downto 1 do
  if ImageEnView1.Layers[ I ] is TIEImageLayer then
    ImageEnView1.LayersRemove( I );
ImageEnView1.UnlockUpdate();


See Also

 IEN_Description
 GetThumbnail
 LoadFromStreamIEN
 SaveToFileIEN
 LayersImport