iseahound / ImagePut

A core library for images in AutoHotkey. Supports AutoHotkey v1 and v2.
https://www.autohotkey.com/boards/viewtopic.php?f=83&t=76633
MIT License
116 stars 24 forks source link

when i use it to set menu tray icon, it looks sharper #17

Open telppa opened 2 years ago

telppa commented 2 years ago

test.zip here is test file.

pic1 is normal 1

pic2 is sharper 2

iseahound commented 2 years ago

1-1 1-2 1-3 1-4

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.

telppa commented 2 years ago

test (2).zip

i tested single dimension .ico files, but still have this problem.

iseahound commented 2 years ago

Looks like different interpolation by windows to me:

2022-07-11 00꞉33꞉19

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:

iseahound commented 2 years ago

Another picture: 2022-07-11 00꞉45꞉28 top cat is 16x16 bottom cat is 24x24 None of the tray icon cats are identical to source

iseahound commented 2 years ago

Feel free to leave this issue open, maybe there is something I can do, but it's not obvious to me now

iseahound commented 4 months ago

Possible info: https://stackoverflow.com/a/76398324