Icon Transparent color problum lazarus / 39-Graphics ---------------------------------------------------------------------- BenJones · 2013-05-09 03:58 hi I am trying to convert a bitmap to a icon, with the image list, it does save tho the transparent color does not, I tested in delphi 7 and it works fine any ideas what's wrong here my code. procedure Tfrmmain.cmdConvertClick(Sender: TObject); var   ico : TIcon; begin    ico := CreateIconFromBitmap(Image1.Picture.Bitmap,clFuchsia);    ico.SaveToFile('c:\out\new.ico'); end; function CreateIconFromBitmap(Bitmap: TBitmap; TransparentColor: TColor): TIcon; begin   with TImageList.CreateSize(Bitmap.Width, Bitmap.Height) do   begin     try       AllocBy := 1;       AddMasked(Bitmap, TransparentColor);       Result := TIcon.Create;       try         GetIcon(0, Result);       except         Result.Free;         raise;       end;     finally       Free;     end;   end; end; The bitmap is also just a 32x32x16 color ---------------------------------------------------------------------- pyros · 2013-05-16 15:34 Hello Ben Jones, you are in luck, since I happened to have spent all afternoon attempting to find the same solution. Anyway, I can't summon any further energy to wade through your code, but this will use a bitmap to make an icon and then save it with transparency (red in this case). Code: [Select]IconPicture := TPicture.Create; IconPicture.Bitmap.SetSize(32, 32); IconPicture.Bitmap.Canvas.StretchDraw(Types.Rect(0, 0, 32, 32), SourceBitmap); IconPicture.Bitmap.Mask(clRed); IconPicture.Icon.SaveToFile(Folder + 'favicon.ico'); IconPicture.Free; Apparently there is also a class TKIcon that supports full alpha!: http://www.lazarus.freepascal.org/index.php?topic=10629.0