when i use it to set menu tray icon, it looks sharper
Opened this issue · 6 comments
Your .ico file contains 4 different versions of the same image - 16x16, 24x24, 32x32, and 48x48.
From https://www.autohotkey.com/docs/commands/Menu.htm#Icon
Slight distortion may occur when loading tray icons from file types other than .ICO. This is especially true for 16x16 icons. To prevent this, store the desired tray icon inside a .ICO file.
So use the .ico format, with Menu, Tray, Icon
because it will automatically load the correct size based on DPI (I think).
Further testing may be needed with single dimension .ico files.
i tested single dimension .ico files, but still have this problem.
Looks like different interpolation by windows to me:
The first cat is your 16x16 icon, and the third cat the 24x24 icon. As you can see, what is shown on the tray is something between 16 and 24.
I don't really know why this is happening, but my best guess is that a different algorithm is used to scale ico vs hbitmaps.
I think:
- HBITMAP is a RGB format with an unofficial "alpha" channel. When LoadImage is called using HBITMAP it uses the black pixels to scale. Because the transparent pixels are
0x00000000
(begins with 0x00 + black), they are ignored, but the semi-transparent pixels just have their alpha channel ignored, so maybe that is why the black border is bigger with HBitmap. - ICO has transparency, so LoadImage behaves correctly.
Feel free to leave this issue open, maybe there is something I can do, but it's not obvious to me now
Possible info: https://stackoverflow.com/a/76398324