How to write a multi-resolution ico?

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
error0x6b
Posts: 1
Joined: 2016-02-25T02:25:49-07:00
Authentication code: 1151

How to write a multi-resolution ico?

Post by error0x6b »

I basically want to do this:

Code: Select all

convert.exe input.png -define icon:auto-resize="256,128,64,48,32,16" output.ico
with my MagickImage-Object, but I don't know how. I also thought on creating the different resolutions by myself, but there's still the problem to save all the different resolution versions into the same ico.
Are multi resolution ico files even supported by the wrapper to this date? And if not, is there a workaround like directly accessing the wrapped functionality? Temporary files are not a problem for me.

My backup plan is to install ImageMagick additionally to the wrapper to use convert.exe, but I want to determine if it's possible without doing it

Thank you very much
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: How to write a multi-resolution ico?

Post by dlemstra »

Most options are methods of the MagickImage class. The command translates to this:

Code: Select all

using (MagickImage image = new MagickImage("input.png"))
{
  image.SetDefine(MagickFormat.Icon, "auto-resize", "256,128,64,48,32,16");
  image.Write("output.ico");
}
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply