converting .PNG to .ICO in C/C#

前端 未结 3 1037
隐瞒了意图╮
隐瞒了意图╮ 2020-12-30 14:27

I want to convert .PNG files to .ICO files. I want to do it locally with out any internet dependency (so I can\'t use online tools like converttoico.com etc).

I foun

3条回答
  •  一向
    一向 (楼主)
    2020-12-30 14:37

    Probably a little bit late, but here´s some c# solution to this:

    using (FileStream stream = File.OpenWrite(@"C:\temp\test.ico"))
    {
        Bitmap bitmap = (Bitmap)Image.FromFile(@"c:\temp\test.png");
        Icon.FromHandle(bitmap.GetHicon()).Save(stream);
    }
    

提交回复
热议问题