ImageEn, unit imageenio

TImageEnIO.SaveToFileICO

TImageEnIO.SaveToFileICO


Declaration

procedure SaveToFileICO(const FileName: WideString);


Description

Saves the current image to a file in ICO format. ICO format allows storing multiple images with different resolutions and sizes.

FileName is the file name including extension.
ImageEn creates for you the sub-images to save, you have only to set the Params.ICO_BitCount and Params.ICO_Sizes arrays.
To control each image separately, use the IEWriteICOImages function.

Notes:
- 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


Demo

Demo  Demos\ImageEditing\IconEditor\IconEditor.dpr


Example

// save the current image in 'output.ico', It will contain three images with 64x64 32bit (24bit +alphachannel), 32x32 256 colors and 32x32 16 colors

// 64x64 x32bit
ImageEnView.IO.Params.ICO.BitCount[0] := 32;
ImageEnView.IO.Params.ICO.Sizes[0].cx := 64;
ImageEnView.IO.Params.ICO.Sizes[0].cy := 64;

// 32x32 x8bit
ImageEnView.IO.Params.ICO.BitCount[1] := 8;
ImageEnView.IO.Params.ICO.Sizes[1].cx := 32;
ImageEnView.IO.Params.ICO.Sizes[1].cy := 32;

// 32x32 x4bit
ImageEnView.IO.Params.ICO.BitCount[2] := 4;
ImageEnView.IO.Params.ICO.Sizes[2].cx := 32;
ImageEnView.IO.Params.ICO.Sizes[2].cy := 32;

// I don't want other images
ImageEnView.IO.Params.ICO.BitCount[3] := 0;
ImageEnView.IO.Params.ICO.Sizes[3].cx := 0;
ImageEnView.IO.Params.ICO.Sizes[3].cy := 0;

// save
ImageEnView.IO.SaveToFile('D:\output.ico');


See Also

- SaveToStreamICO
- LoadFromFileICO
- ICO_ImageIndex
- ImageCount
- IEWriteICOImages
- Global Image Methods