ImageEn, unit imageenview

TImageEnView.LayersSaveMergedTo

TImageEnView.LayersSaveMergedTo


Declaration

function LayersSaveMergedTo(Destination: TIEBitmap; FastOutput: Boolean = False): Boolean; overload;
function LayersSaveMergedTo(const Filename: string; FastOutput: Boolean = False): Boolean; overload;
function LayersSaveMergedTo(const Stream: TStream; FileType: TIOFileType; FastOutput: Boolean = False): Boolean; overload;


Description

Output a merged version of all layers to a TIEBitmap, file or stream.
This method will preserve any alpha channel in the image.
Pass FastOutput as True, if you only require a low quality output (without quality filtering or anti-aliasing). This is useful if you will downsize to a thumbnail for example.
Result is true if a save error is encountered.

Note:
 LayersMergeFilter will specify the quality of image layers, if they do not have a custom UseResampleFilter
 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.
 The existing image is not changed.


LayersDrawTo vs LayersSaveMergedTo

Both LayersDrawTo and LayersSaveMergedTo perform a similar function and generally the result is indistinguishable.
LayersDrawTo is intended for actual rendering (giving an identical result to that seen in the source TimageEnView). It supports all layer options, so should be used for an image that will be saved or printed. Generally, it is faster than LayersSaveMergedTo. It also supports TIEBitmap rendering options, such as Contrast and ChannelOffset. It does not support transparency.
LayersSaveMergedTo creates a copy of layers using Alpha Compositing (the result is equivalent to calling LayersMerge([]). It is mainly used when transparency needs to be preserved.


Example

// Save a merged version of the layers in ImageEnView1 (preserving the alpha channel)
aBitmap := TIEBitmap.Create;
ImageEnView1.LayersSaveMergedTo( aBitmap );
aBitmap.Write( 'd:\Merged.png' );
aBitmap.Free;

// Or alternatively
ImageEnView1.LayersSaveMergedTo( 'd:\Merged.png' );

// Create a thumbnail of this image
aBitmap := TIEBitmap.Create;
ImageEnView1.LayersSaveMergedTo( aBitmap, True );
aBitmap.Resample( 100, 100, rfFastLinear, True );
aBitmap.Write( 'd:\Thumb.jpeg' );
aBitmap.Free;


See Also

 LayersDrawTo
 SaveToFileIEN
 SaveToStreamIEN
 LayersMergeAll