Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
telppa opened this issue Jul 10, 2022 · 6 comments
Open

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

telppa opened this issue Jul 10, 2022 · 6 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@telppa
Copy link

telppa commented Jul 10, 2022

test.zip
here is test file.

pic1 is normal
1

pic2 is sharper
2

@iseahound
Copy link
Owner

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
Copy link
Author

telppa commented Jul 11, 2022

test (2).zip

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

@iseahound
Copy link
Owner

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:

  • 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.

@iseahound
Copy link
Owner

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
Copy link
Owner

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

@iseahound iseahound added bug Something isn't working help wanted Extra attention is needed labels Nov 27, 2022
@iseahound
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants