Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have problem with saving bitmap as an .ico file. Standard icon.save reduce color depth from 32 to 4 bpp which destroys good look of my picture. Is there any possibility to change that? I´ve tried bitmap save as imageformat.icon but this return gdi++ error.

this is my code:
C#
Image image = Image.FromFile(previewPath);
Image newImage = image.GetThumbnailImage(256, 256, null, new IntPtr());

Stream IconStream = System.IO.File.OpenWrite(iconPath);
Bitmap bitmap = new Bitmap(newImage);

Icon icon = System.Drawing.Icon.FromHandle(bitmap.GetHicon());
icon.Save(IconStream);
icon.Dispose();
bitmap.Dispose();
IconStream.Close();
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900