Declaration
ICO_Sizes: TIOICOSizes;
Description
An array of TSize structures which specify the dimensions of all images contained in an icon file.
Note: The last item must specify the size as 0 x 0.
// Save the current image as 'output.ico'. It will contain three images with 64x64 32bit (24bit + alphachannel), 32x32 256 colors and 32x32 16 colors
// 64 x 64 x 32bit
ImageEnView.IO.Params.ICO_BitCount[0] := 32;
ImageEnView.IO.Params.ICO_Sizes[0].cx := 64;
ImageEnView.IO.Params.ICO_Sizes[0].cy := 64;
// 32 x 32 x 8bit
ImageEnView.IO.Params.ICO_BitCount[1] := 8;
ImageEnView.IO.Params.ICO_Sizes[1].cx := 32;
ImageEnView.IO.Params.ICO_Sizes[1].cy := 32;
// 32 x 32 x 4bit
ImageEnView.IO.Params.ICO_BitCount[2] := 4;
ImageEnView.IO.Params.ICO_Sizes[2].cx := 32;
ImageEnView.IO.Params.ICO_Sizes[2].cy := 32;
// Specify end of 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');
// Load the highest quality frame in an icon file
procedure LoadLargestIconFrame(Dest: TIEBitmap; const IconFile: string);
var
bmp: TIEBitmap;
params: TIOParams;
largestSz, largestIdx, sz: Integer;
i: Integer;
begin
bmp := TIEBitmap.Create();
params := TIOParams.Create();
try
if params.Read(IconFile) = False then
raise Exception.create( 'Load Error' );
largestIdx := 0;
if params.ImageCount > 1 then
begin
largestSz := 0;
for i := 0 to params.ImageCount - 1 do
begin
sz := params.ICO_Sizes[i].Width * params.ICO_Sizes[i].Height;
if sz > largestSz then
begin
largestSz := sz;
largestIdx := i;
end;
end;
end;
params.ImageIndex := largestIdx;
bmp.Read(IconFile, params);
Dest.Assign( bmp );
finally
params.Free;
bmp.Free;
end;
end;