184

I simply want to have an .ico file that has multiple sizes of the icon image contained within it. I'd like it for use in a cross-platform desktop application (so that, e.g. on Windows, the 16x16 size is used for the app's top bar but a 32x32 size version is used when the various open apps are shown when using Alt-Tab). Once I have that .ico file, I know how to use it within my widget toolkit to get this effect, but I don't know how to get it.

How can I make such a file?

Community
  • 1
  • 1
cm70
  • 1,857
  • 2
  • 12
  • 3
  • 4
    This link is the easiest - I'm astounded how many ICO generators just scale down a larger image. That defeats the whole purpose! This one works well - although you will need to enable Flash if using Chrome. – Simon_Weaver Nov 07 '16 at 23:00
  • Using [ImageMagick](https://unix.stackexchange.com/a/89276/1806) command line tool – jcubic Dec 06 '18 at 15:29
  • This was a pretty excellent resource for understanding what's required for the various ICO sizes: https://www.creativefreedom.co.uk/icon-designers-blog/windows-7-icon-sizes/ – icc97 Dec 09 '18 at 15:45
  • See also: https://stackoverflow.com/questions/3185677/converting-gifs-pngs-and-jpgs-to-ico-files-using-imagemagick – icc97 Dec 09 '18 at 16:01
  • See also: https://stackoverflow.com/questions/11423711/recipe-for-creating-windows-ico-files-with-imagemagick – icc97 Dec 09 '18 at 16:02
  • 1
    If you have images and just want to create the ICO files you can drag and drop them into [Penteract Icon File Creator](https://www.microsoft.com/en-us/p/penteract-icon-file-creator/9nblggh6jv7f). It's not free but it has a free trial. Windows 10 only (Windows Store). – 123 Jun 14 '19 at 11:52
  • @jcubic imagemagick will break [files with 256x256 icons](https://github.com/ImageMagick/ImageMagick/issues/1577) – phuclv Oct 28 '19 at 07:36
  • @phuclv check dlm answer it show command with 256 icon (that new one), but I didn't test it though. – jcubic Oct 28 '19 at 08:08
  • https://onlineconvertfree.com - this platform is great for all sort of file-type conversions. https://onlineconvertfree.com/convert/ico/ is for ICO. – Aakash Feb 28 '20 at 05:01

8 Answers8

150

This can be done for free using GIMP.

It uses the ability of GIMP to have each layer a different size.

I created the following layers sized correctly.

  • 256x256 will be saved as 32bpp 8bit alpha
  • 48x48 will be saved as 32bpp 8bit alpha
  • 48x48 will be saved as 8bpp 1bit alpha
  • 32x32 will be saved as 32bpp 8bit alpha
  • 32x32 will be saved as 8bpp 1bit alpha
  • 32x32 will be saved as 4bpp 1bit alpha
  • 16x16 will be saved as 32bpp 8bit alpha
  • 16x16 will be saved as 8bpp 1bit alpha
  • 16x16 will be saved as 4bpp 1bit alpha

Notes

  • You may need to check other resources to confirm to yourself that this is a sensible list of resolutions and colour depths.
  • Make sure you use transparency round the outside of your image, and anti-aliased edges. You should see the grey checkerboard effect round the outside of your layers to indicate they are transparent
  • The 16x16 icons will need to be heavily edited by hand using a 1 pixel wide pencil and the eyedropper tool to make them look any good.
  • Do not change colour depth / Mode in GIMP. Leave it as RGB
  • You change the colour depths when you save as an .ico - GIMP pops up a special dialog box for changing the colour settings for each layer
Community
  • 1
  • 1
Greg Woods
  • 2,697
  • 2
  • 26
  • 18
  • I can confirm after a few hours of my ICO not working that saving with these exact sizes / settings fixed the problem. –  Nov 21 '12 at 00:38
  • 1
    The IcoFX program is much easier to work with. It only took me 5 minutes to create 3 new icons, with each one having 16x16, 32x32 and 48x48 resolutions. – dodgy_coder Jan 31 '13 at 07:30
  • 8
    I had all the images already, delivered by the artist for mac. All I had to do was open one of them in Gimp, and the choose "Open as layers.." on the remaining ones. All layers are automatically created in the correct size, export to ico and presto! – Nicolas Mommaerts May 15 '13 at 22:25
  • 1
    is there a way to do this in a batch manner? When working in GIMP, I always have to save my multi-layered image as png and then open it again and create the multiple layers. That takes very long. – Tomáš Zato May 14 '14 at 13:15
  • 10
    There is a nice GIMP plugin called iconify2 that does this. See http://registry.gimp.org/node/27989 – Chris Morlier Dec 28 '15 at 19:41
  • 1
    Using GIMP worked like a charm, great advice! Heads up, if the icon is an SVG it avoids the faff with the 16x16 size. – gbavba Dec 06 '18 at 17:01
  • @ChrisMorlier that link is broken now, https://web.archive.org/web/20180319121148/http://registry.gimp.org/node/27989 – icc97 Dec 09 '18 at 15:38
  • @dodgy_coder as disappointing as it is to admit from a FOSS perspective, after struggling with first GIMP and then ImageMagick getting a transparent PNG to ICO converted that didn't look ugly at 32x32 or have issues getting cut off at certain sizes only worked when using icofx – icc97 Dec 09 '18 at 15:42
119

ImageMagick, the free and open source image manipulation toolkit, can easily do this:

Note: Since ImageMagick 7, the CLI has changed slightly, you need to add magick in front of any commands.

magick convert icon-16.png icon-32.png icon-64.png icon-128.png icon.ico

See also http://www.imagemagick.org/Usage/thumbnails/#favicon, that has the example:

magick convert image.png -bordercolor white -border 0 \
          \( -clone 0 -resize 16x16 \) \
          \( -clone 0 -resize 32x32 \) \
          \( -clone 0 -resize 48x48 \) \
          \( -clone 0 -resize 64x64 \) \
          -delete 0 -alpha off -colors 256 favicon.ico

There is also now the shorter:

magick convert image.png -define icon:auto-resize="256,128,96,64,48,32,16" favicon.ico
user2084795
  • 704
  • 1
  • 7
  • 20
dlm
  • 4,054
  • 2
  • 23
  • 19
  • 7
    Note that this command will remove the alpha channel and replace it with white. – Abe Voelker Mar 16 '14 at 16:03
  • 4
    @AbeVoelker I guess if you leave out the "alpha off" it won't do that. I didn't involve also the "-bordercolor white -border 0" parts either. And since my source png was already 64x64, the last part of the clone didn't have the resize. – Csaba Toth Jun 21 '14 at 21:23
  • 4
    I love command line solutions, but bear in mind that the automatically resized 16x16 will probably look like mush. Icons this small should really be drawn by hand pixel-by-pixel. In that case the GIMP solution I posted may be better. It depends on your priorities. – Greg Woods Oct 09 '14 at 15:03
  • 4
    Just a note that, yes, the imagemagick example isn't ideal because of the scaling issues (and the alpha stuff etc) but it gives a neat illustration of what's possible in a single command line. The first example, which assumes you have already created a set of (possibly hand-drawn) icons at each size, is probably going to give your the best results in a very simple command. – dlm Mar 13 '15 at 19:22
  • @Abe Voelker: cannot confirm! Given an alpha png the resulting ico has the correct alpha channel! (icon.ico example 1!) – ewerybody Aug 17 '15 at 13:25
  • @GregWoods: cannot confirm! Given a 16x16 png will result with the correct 16x16 pixel icon in the ico file. Just tested all of this. – ewerybody Aug 17 '15 at 13:27
  • 1
    You can also merge pngs into an ico through a variety of [online tools](http://icoconvert.com/Multi_Image_to_one_icon/) – KyleMit May 25 '16 at 15:12
  • On WSL had to call only the `convert image.png -define icon:auto-resize:256,48,32,24,16 favicon.ico` part – Er... Apr 21 '19 at 15:28
  • be careful, ImageMagick will break [files with 256x256 icons](https://github.com/ImageMagick/ImageMagick/issues/1577) – phuclv Oct 28 '19 at 07:38
43

The excellent (free trial) IcoFX allows you to create and edit icons, including multiple sizes up to 256x256, PNG compression, and transparency. I highly recommend it over most of the alternates.

Get your copy here: http://icofx.ro/ . It supports Windows XP onwards.


Windows automatically chooses the proper icon from the file, depending on where it is to be displayed. For more information on icon design and the sizes/bit depths you should include, see these references:

mgarciaisaia
  • 14,521
  • 8
  • 57
  • 81
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • 9
    As an update to this post: IcoFX is no longer free but does allow 15 evaluation runs. Do not down-vote this post as it was free at the time of writing. – PaulSkinner Aug 29 '12 at 16:20
  • 1
    IcoFX worked well for me. I just downloaded it and the limitation now is that the Save function will be disabled after 30 days. – dodgy_coder Jan 31 '13 at 07:27
  • says its $50 not free. – chovy May 03 '13 at 23:22
  • 6
    @chovy It *used* to be free—at the time this answer was written. The developer has changed that now. I continue to use the old version (1.6.4), which is free. I don't think the enhancements are worth paying for. You can probably find a download link if you Google it. – Cody Gray - on strike May 07 '13 at 22:52
  • +1 When IcoFX starts, select "Create Windows icon from image" in the "did-you-know-first-time-intro" popup that appears. – Nicolas Raoul Jun 07 '13 at 07:27
  • 7
    is this legal? last freeware version: http://www.321download.com/LastFreeware/page40.html#IcoFX –  Nov 27 '13 at 10:42
  • @user359135 I don't know where you got that link from but the link given in the answer https://icofx.ro/ gave a direct download to this file: https://icofx.ro/files/icofxsetup.exe . Looks legitimate to me. – icc97 Dec 09 '18 at 15:26
  • 1
    Having tried both GIMP and ImageMagick for converting a transparent PNG file to a transparent ICO file, icofx gave a much better image quality for the 32x32 and 16x16 transparent icons - these are the ones that are seen the most as they appear on the task bar and the application icon in the top left hand corner. – icc97 Dec 09 '18 at 15:30
13

'@icon sushi' is a portable utility that can create multiple icon ico file for free.

Drag & drop the different icon sizes, select them all and choose file -> create multiple icon.

You can download if from http://www.towofu.net/soft/e-aicon.php

Drakarah
  • 2,244
  • 2
  • 23
  • 23
  • 2
    This is better software than I expected; it even lets you edit the alpha channel or transparency mask in-place (though the UI for that is odd). – Chel Aug 26 '15 at 16:24
13

What i do is to prepare a 512x512 PNG, the Alpha Channel is good for rounded corners or drop shadows, then I upload it to this site http://convertico.com/, and for free then it returns me a 6 sizes .ico file with 256x256, 128x128, 64x64, 48x48, 32x32 and 16x16 sizes.

JorgeRenteral
  • 176
  • 1
  • 5
2

Visual Studio Resource Editor (free as VS 2013 Community edition) can import PNG (and other formats) and export ICO.

vladon
  • 8,158
  • 2
  • 47
  • 91
1

I found an app for Mac OSX called ICOBundle that allows you to easily drop a selection of ico files in different sizes onto the ICOBundle.app, prompts you for a folder destination and file name, and it creates the multi-icon .ico file.

Now if it were only possible to mix-in an animated gif version into that one file it'd be a complete icon set, sadly not possible and requires a separate file and code snippet.

j0k
  • 22,600
  • 28
  • 79
  • 90
deanflory
  • 11
  • 1
-15

Fresh answer 2018:

Step 1 Launch Microsoft Paint. Not Paint.Net but plain Paint

Step 2 Open the image you want to convert to icon format by clicking the “Paint” toolbar tab and selecting “Open.”

Step 3 Click the “Paint” tab, highlight the “Save As” option and select the “BMP picture” option. As 256-colored. There is a dropdown list.

Step 4 You have to open it in Paint.net now. Enter a file name for the icon and type “.ico” (without quotations) as the file extension. Select your preferred output folder for the icon and click “Save.”(still in bmp type) , exposing auto definition in saving parameters window.

This is a solution for those WHO DOESN'T WANT THE THIRD PARTY APPS TO GAIN PERMISSIONS ON THEIR COMP.
I use this simple way to create custom icons for folders on my desktop or documents.

CodeToLife
  • 3,672
  • 2
  • 41
  • 29
  • 2
    maybe this could give you a simple single size ICO file, but this won't give you the requested "multiple size" ICO file (a single ico file that contain multiple versions of the same icon at different resolutions) – Max Nov 19 '15 at 08:39
  • @Max yes, you are correct – CodeToLife Nov 24 '15 at 21:41