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

[Request]: Use a better image scaling algorithm to avoid blurry avatars #383

Closed
2 of 4 tasks
nekohayo opened this issue Jul 16, 2023 · 6 comments
Closed
2 of 4 tasks
Labels
enhancement New feature or request

Comments

@nekohayo
Copy link

Describe the request

Tuba's scaling of avatars in the timeline view makes them look very blurry compared to the ones shown in the Mastodon web UI (or even compared to your avatar in the top-left corner of the UI). This is on a regular (non-HiDPI) screen.

Underneath is Epiphany (or Firefox, or any browser)'s rendering of avatars on the Mastodon web interface, and on top of it is Tuba's rendering of those same avatars. I don't think you'll be able to un-see this :)

Screenshot from 2023-07-16 17-04-31

The Mastodon web UI does not pre-process/pre-scale those images, the browser scales them in realtime, as we can see by right-clicking avatars in this thread and opening their images in new tabs.

Could it be that Tuba is pre-scaling them down somehow (vs preserving a higher density version), or that it would need to use a different scaling algorithm? (in that case wonder if it's the same—or opposite—problem as the pixmaps that used bad scaling in Amberol...)

Implementation Details

  • This should be an option in settings.
  • This should be only available to some fediverse backends. (Include which ones on the above field).
  • This is client-only (and shouldn't sync with the instance).
  • This follows the GNOME HIG.
@nekohayo nekohayo added the enhancement New feature or request label Jul 16, 2023
@GeopJr
Copy link
Owner

GeopJr commented Jul 16, 2023

Tuba does not touch scaling, the workflow is: GET image -> Pixbuf from inputstream -> Texture for Pixbuf

Since they are AdwAvatars, libadwaita is responsible for filtering, specifically these lines: https://gitlab.gnome.org/GNOME/libadwaita/-/blob/main/src/adw-avatar.c#L245-269

@alice-mkh
Copy link

alice-mkh commented Jul 17, 2023

As you can see, libadwaita just uses the GTK API for scaling textures there, not some custom drawing that can blur images weirdly.

It's also similar to the Amberol issue, but kinda tangentionally. The old Amberol rendering from that issue is same as what libadwaita had before 1.3. The one Amberol does now is same as what libadwaita does (except the Amberol one breaks on hidpi, that's what the scale factor part is about in the libadwaita code, see the fix), and you should see the same quality if you use your avatar as a cover art.

So if you don't like how GTK downscales images, that would be GTK and not libadwaita.

@GeopJr
Copy link
Owner

GeopJr commented Jul 17, 2023

Thanks for the info Alice!

I'll go ahead and close this.

@GeopJr GeopJr closed this as not planned Won't fix, can't repro, duplicate, stale Jul 17, 2023
@nekohayo
Copy link
Author

Hang on... this apparently already exists in GTK, and therefore the app (or libadwaita?!) should do it, if this closed ticket is any indication:

There is now a way to use trilinear filtering (ie mipmaps) when downscaling.

@alice-mkh
Copy link

It does do it. That's what you're seeing.

@nekohayo
Copy link
Author

Based on the various chat discussions, I have now filed an issue in GTK itself, as presumably the trilinear filtering is not giving the expected results: https://gitlab.gnome.org/GNOME/gtk/-/issues/5980

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

No branches or pull requests

3 participants