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

Blurry icons on MacOS #163

Open
andreypolyak opened this issue Apr 3, 2024 · 3 comments
Open

Blurry icons on MacOS #163

andreypolyak opened this issue Apr 3, 2024 · 3 comments

Comments

@andreypolyak
Copy link

Hi,
thanks for the lib!

I have a problem with setting up high-quality retina icons on MacOS.

I think it happens because of this code:

if self._icon.size == size:
source = self._icon
else:
source = PIL.Image.new(
'RGBA',
size)
source.paste(self._icon.resize(
size,
PIL.Image.LANCZOS))

On my laptop (13" MacBook Air M1), self._status_bar.thickness() is 22px. So, to make it retina-quality (2x), I need to pass an icon with a 44x44px resolution. But then the code above resizes it back to 22x22px, and the icon becomes blurry.

Would be great to have some way to pass high-quality retina icons!

@simonrob
Copy link
Contributor

I worked around this (and added various other functionality) here in case it helps.

@moses-palmer
Copy link
Owner

Thank you for your report and suggestions!

I have incorporated some of your changes in fixup/general. @andreypolyak, does this resolve your issue?

@scosman
Copy link

scosman commented Oct 30, 2024

haha, I figured all of this out yesterday, only to find your branch today. 🤦

@moses-palmer I think there's still one issue. Since you resize the image before loading the NSImage, it will still be blurry, as the image resolution is too small. The size is in "points" on a Mac, not pixels. The image should have at least 3x more pixels than the points for high resolution displays.

I took a stab at the fix here: #176 . The alternative is don't do any image resizing on Mac, just set the size, and let NSImage handle it (which it can).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants