converting .PNG to .ICO in C/C#

前端 未结 3 1024
隐瞒了意图╮
隐瞒了意图╮ 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);
    }
    
    0 讨论(0)
  • 2020-12-30 14:37

    ImageMagick is the most awesome CLI image manipulation utility ever made:

    convert image.png image.ico
    

    It's that easy, and it works with virtually every format you throw at it.

    Also, it has APIs for a quite a few different languages (C#, if I remember correctly).

    0 讨论(0)
  • 2020-12-30 14:52

    You can use ImageMagick library that can convert png to ico , you can find imageMagick for .NET here : http://imagemagick.codeplex.com/ .

    If you need a program to do that you can try with IrFanView in batch mode ...

    0 讨论(0)
提交回复
热议问题