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

Set minimum image/icon size #392

Closed
xkr47 opened this issue Sep 27, 2017 · 15 comments
Closed

Set minimum image/icon size #392

xkr47 opened this issue Sep 27, 2017 · 15 comments

Comments

@xkr47
Copy link
Contributor

xkr47 commented Sep 27, 2017

On HiDPI (280dpi) displays icons embedded in notifications are sometimes too small to see, so an option to set the minimum image/icon size (e.g. upscale image if too small) would be appreciated.

@tsipinakis
Copy link
Member

There is an option to downscale an icon but upscaling would have some serious quality issues. Is there a reason why you're not using a higher resolution icon pack?

@xkr47
Copy link
Contributor Author

xkr47 commented Sep 29, 2017

Yes I am entirely aware of this :)
But I'm talking about icons embedded in notifications originating from web sites which I am not in control of. The images look fine on 100dpi displays. Upscaling won't make them look much worse than that I suppose. Now it's hard to recognize the images (people's faces mostly) when they are only ~2mm (0.1in) big on the display, so just seeing them bigger even if they would be a bit blurry would actually help.
The default could be set to 0 so no upscaling would occur unless the user really wants it.
I could even give a shot at implementing this if you don't mind?

xkr47 added a commit to xkr47/dunst that referenced this issue Sep 29, 2017
xkr47 added a commit to xkr47/dunst that referenced this issue Sep 29, 2017
@xkr47
Copy link
Contributor Author

xkr47 commented Sep 29, 2017

It ended up being quite simple; see PR #393. Works for me :) And it really helps.

@bebehei
Copy link
Member

bebehei commented Sep 30, 2017

I'm not a user of a HiDPI screen. Can somebody explain me this situation?

I see and understand, why the image gets too small, when using higher DPIs and your software is not DPI-aware. But if I understand correctly, dunst should be DPI-aware (#240). So, why does the icon get displayed too small? Shouldn't be the best fix to scale the icon DPI-aware, too?

@xkr47
Copy link
Contributor Author

xkr47 commented Oct 1, 2017

hmm.. I'm actually using an older snapshot from this summer because the xrandr library in devuan is a bit old. I failed to realize there was dpi stuff taking care of this in latest version so I took my own approach instead. So maybe we can close this for now and reopen later if there is still need. Sorry for the disturbance.

@bebehei
Copy link
Member

bebehei commented Oct 1, 2017

@xkr47 Just because I say dunst should be DPI-aware, doesn't make dunst automatically fully DPI-aware.

There may be some bugs. Are you sure, that dunst scales now the icon correct?

@nikarh
Copy link

nikarh commented May 28, 2019

It would still be nice to have min_icon_size for icon themes consisting solely of SVG images (such as https://github.com/daniruiz/flat-remix).

@ShawnMcCool
Copy link

This would be a fantastic feature for SVG as so many laptops have higher resolutions now. Dunst renders svg icons very small and I can't find a way to make them larger.

xkr47 added a commit to xkr47/dunst that referenced this issue Nov 25, 2019
@xkr47
Copy link
Contributor Author

xkr47 commented Nov 25, 2019

@nikarh @ShawnMcCool,
I got my branch (which I still use) updated to the latest master a few days ago, but I haven't really tested the DPI based proposals suggested here. Here's the current version for those that want it.. xkr47@16fc3b2

@tsipinakis
Copy link
Member

@xkr47 I'm not sure at what size gdk loads svgs by default but from what you're doing there might be quality loss when upscaling the loaded svg since it's converted to bitmap.

If you'd like to prepare it for a proper PR/merge then you can use gdk_pixbuf_new_from_file_at_scale in get_pixbuf_from_icon to handle min_icon_size and keep the existing downscaling code as-is.

@xkr47
Copy link
Contributor Author

xkr47 commented Nov 28, 2019

Wouldn't it make sense to do both up & downscaling using that method then? Also great idea, thanks!

@xkr47
Copy link
Contributor Author

xkr47 commented Nov 29, 2019

Ok looking at the code I see I misunderstood your point a bit.. but icon_pixbuf_scale() is used also from notification_icon_replace_data() when image pixels are embedded in the notification message, like spotify for example does with music album images. In this case up & downscaling is still needed.

So I think the best result would be keeping my code and also use the gdk_pixbuf_new_from_file_at_scale() you suggested, in which case my min_size logic should just have no effect..

@tsipinakis
Copy link
Member

I forgot about that detail, you're right.

So I think the best result would be keeping my code and also use the gdk_pixbuf_new_from_file_at_scale() you suggested, in which case my min_size logic should just have no effect..

This sounds good to me, if you can add that and submit a PR I'll merge it.

xkr47 added a commit to xkr47/dunst that referenced this issue Nov 29, 2019
tsipinakis added a commit that referenced this issue Dec 18, 2019
@xkr47
Copy link
Contributor Author

xkr47 commented Dec 18, 2019

@nikarh @ShawnMcCool this feature is now merged to master! Look out for the next release for some scaling goodness! :)

  • SVGs are now both up- & downscaled "the right way" so can give better renders even for those not enabling the new min_icon_size option.

@ShawnMcCool
Copy link

ShawnMcCool commented Dec 29, 2019 via email

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

5 participants