Icons and cursors are a little strange in ImageEN compared to most of the other image types.
// this loads a png file, resamples it to 32x32 and saves the result as an icon
var
img: TImageEnView;
aFileName: string;
begin
img := TImageEnView.Create ( nil );
try
if OpenPictureDialog1.Execute then
begin
aFileName := OpenPictureDialog1.FileName;
if LowerCase( ExtractFileExt( aFileName ) ) = '.png' then
begin
img.IO.LoadFromFilePNG ( aFileName );
img.Proc.Resample ( 32, 32, rfNone, True );
img.IO.Params.ICO_Sizes [ 0 ].cx := 32;
img.IO.Params.ICO_Sizes [ 0 ].cy := 32;
img.IO.SaveToFileICO ( ChangeFileExt ( aFileName, '.ico' ) );
end;
end;
finally
img.Free;
end;
end;
... but I am surprised your code even compiles because there is no ExchangeFileExt function that I am aware of... try ChangeFileExt instead.
William Miller