Save Icon Form ImageList lazarus / 39-Graphics ---------------------------------------------------------------------- BenJones · 2013-05-08 07:10 Hi I am trying to save a icon from the Imagelist control, I managed to load my bitmap in and save it as a icon, but the only problum it saveing as a default XP color depth, is there any way to set the color depth of the image list here my code I have for saving. I like to save as maybe a 16 color icon or 256 color. Code: [Select]procedure Tfrmmain.cmdConvertClick(Sender: TObject); var   imgl : TImageList;   img : TBitmap;   ico : TIcon; begin   //Icon to create.   ico := TIcon.Create;   //Load bitmap image to be stored into listimages.   img  := TBitmap.Create;   img.LoadFromFile('c:\out\ben.bmp');   //Create the image list for 32x32 icons.   imgl := TImageList.CreateSize(32,32);   //Add bitmap and transparent color.   imgl.AddMasked(img,RGBToColor(255,0,255));   //Fetch icon   imgl.GetIcon(0,ico);   //Save icon to file   ico.SaveToFile('c:\out\test.ico');   //Free up memory.   imgl.Free;   img.Free;   ico.Free; end; ---------------------------------------------------------------------- pyros · 2013-05-14 15:39 Hi Ben, I'm not sure, but you can tidy up your code a bit with this: Code: [Select]var IconPicture: TPicture; begin IconPicture := TPicture.Create; IconPicture.Bitmap.LoadFromFile('c:\out\ben.bmp'); IconPicture.Bitmap.SetSize(32, 32); IconPicture.Icon.SaveToFile('c:\out\test.ico'); IconPicture.Free; Sadly inserting the line: Code: [Select]IconPicture.Icon.PixelFormat := pf8bit;before calling SaveToFile only seems to hang execution. Post back if you make any progress. ---------------------------------------------------------------------- BenJones · 2013-05-28 06:19 Thanks pyros if I find anything I let you know as I am still in need of this,