Just skip to the answer at the answer section, the question part has speculations and mistakes. The answer is based on experiment and it is accurate.
For a long time I have used a single png packed 256px ico file for my Visual Studio projects, and it worked well, cause scaling works fine on those icons and they take almost no space, and I did not care that much before.
But now I have an icon that needs to "retain hard edges", it is "pixel art". If I build with a 256px version downscales terribly or if I build with 16px upscales slightly less terribly but not good enough. So my questions are:
What are the sizes I have to generate to merge into the ico (I don't care about pre win7 icons)?
If I got that list, do I have to generate 1.25x, 1.5x and 2.0x versions for high dpi settings?
Finally, some apps like firefox has a large icon on start menu inside the medium square block, my apps have a smaller one in the center like Visual Studio does, how can I put a large icon in the start menu medium sized square?
I did found it: Unfortunately VS says: VisualElements is not supported in a Windows Presentation Foundation (WPF) project. Is there a way around this?
I looked around and collected possible sizes @1x(96DPI):
16, 20, 24, 30, 32, 40, 48, 50, 64, 128, 150, 256, 512, 768
Mostly I collected these from Which icon sizes should my Windows application's icon include?.
Not that bad, but if I add 1.25x, 1.5x, 2.0x then we get:
16, 20, 24, 25, 30, 32, 36, 38, 40, 45, 48, 50, 60, 62, 64, 72, 75, 80, 96, 100, 128, 150, 160, 188, 192, 225, 256, 300, 320, 384, 512, 640, 768, 960, 1024, 1152, 1536 In my case it makes a 500k ico file and as it seems the 1024 is the max resolution you can put into an ico file, my icon is pixelated so compresses really well with png and still ~500k.
I also made an ico has all of the above resolutions in rgba, and every one has its size on it, so you can see which windows loads on which dpi setting. you can download it from here and use it in a vs project to test.
As I understand everything under 256px can't be png compressed, is this right?
And do I need all these sizes to retain a pixel perfect icon? Are only 32bit(RGBA) pngs okay? I hope I don't need to include other depths.
After i wrote an ico writer from the spec I realized that pngs can have 0 for resolution cause 1 byte is available for x or y(but i have never seen an ico that is non square, maybe curs can be non square), in this case probably the first one in the file with zeros for resolution going to be used...This is not sure but I think its not far from the truth. See images. Rescaling issues are still confusing me, if I'll have some time tomorrow I'll test it. A pixel perfect icon seems to be imposible to do: having one image to rescale to anything above 256px.
The icons you see in Windows 10 are packed into a icon font named
Segoe MDL2 Assets
& all built-in UWP apps like Groove Music are using this font for icons. Also some apps in the Windows store using it.The answers:
Are PNGs are acceptable under 256px inside ICO file?
Microsoft states that the sizes under 256px should be a BMP without the first 14 bytes.
But at least in the case of windows 10, the answer is YES.
Can you add larger than 1024px image into the ICO?
YES. As long as it is a PNG it can be as big as you want.
Note the "one icon over 255px" limitation:
You can only add one image larger than 255px ( you can add more but windows will only read the first image block in the ICO head where the resolution is 0,0). The format specifies 1 byte for each dimension. See table #2.
What sizes to include for all DPI setting?
Windows 10 uses the following icon sizes (see table below):
16, 20, 24, 28, 30, 31, 32, 40, 42, 47, 48, 56, 60, 63, 84 and one larger than 255px.
Note that Windows RT apps do not use ICO files, they use PNGs or Fonts, this is from Firefox's source:
So how Firefox has a large icon on start menu in the medium tile?
Well its include this above file in the exe directory before the shortcut added to start menu, this article explains it how. My app has an example.
If you make icons for Windows 10 you are better off with my tool and photoshop (or something like that) than anything else, I tried editors and they suck.
win10iconTools by me
You can create ICO files (as MS recommendation or not) or create icons with resolution printed on them, the latter is what I used to make the table.
Supports multiple resize modes including nearest neighbor. If you want to you can use it on other windows versions, it works with .net2, test another windows, send me the results and I extend the table for the good of mankind.
As for pixel art in icons it is not possible to be perfect :(, unless we can change the scaling algorithm in windows 10. So a wide range 84-256 gets the scaled to "0" (see above), so there is no real point adding something bigger that 256 as I see it now you should create a 256px image for "0". (See table why)
If Windows gets all icons 16 to 255 + the 1 larger than 255 (0 in the table) chooses these sizes: (so no markdown tables here?, its kind of wide, the tables are in the app readme also)
There are 27 zoom increments on desktop
and 45 zoom increments on explorer (including the defaults from the menu on the "bottom level")
Icon format specification: