gtk issueshttps://gitlab.gnome.org/GNOME/gtk/-/issues2024-02-12T08:43:16Zhttps://gitlab.gnome.org/GNOME/gtk/-/issues/5980Downscaling medium-sized images to small sizes (avatars) with OpenGL renderer...2024-02-12T08:43:16ZJeff FortinDownscaling medium-sized images to small sizes (avatars) with OpenGL renderer gives blurry resultsTLDR: images downscaled to avatar sizes (ex: something like 48x48) by GTK are blurry, unlike the same images downscaled to the same sizes by GIMP (with any interpolation algorithm) or on-the-fly by any web browser (tested with Firefox an...TLDR: images downscaled to avatar sizes (ex: something like 48x48) by GTK are blurry, unlike the same images downscaled to the same sizes by GIMP (with any interpolation algorithm) or on-the-fly by any web browser (tested with Firefox and Epiphany).
This was initially reported at https://github.com/GeopJr/Tuba/issues/383
This may or may not be tangential to @blobcodes' issue #5160, as it happens in the current latest stable versions of GTK4 / everything provided in an up-to-date Fedora 38.
The dynamically-sized avatar images seen in [this thread](https://mastodon.social/@garrett@mastodon.xyz/110725177921545361), particularly Garrett's photo, illustrate the problem very well. But I'm not sure I have the rights to Garrett's photo to be used as a sample, so here are some CC-licensed benchmark images I made (by cropping, resizing to medium size, and sharpening) from [this](https://en.wikipedia.org/wiki/File:Morgan_Freeman_1998.jpg) and [this](https://en.wikipedia.org/wiki/File:Woman_in_Eyeglasses_-_Marcelo_Chagas.jpg) photo:
* [My sample photo file no1](/uploads/4c663432b0a9252f95fe3fda5c8c075b/Morgan_Freeman_1998_medium__sharpened_mozjpeg.jpg)
* [My sample photo file no2](/uploads/ebfc902c395aed2d5105c20d40851ec4/Woman_in_Eyeglasses_medium__slightly_sharpened_mozjpeg.jpg) (I picked this photo because the glasses and fine hair strands exhibits the problem particularly well, like Garrett's avatar)
Let's take 48x48 pixels as the benchmark target downscaling size (it seems to be approximately the size of avatars in Tuba and Mastodon?).
If I scale them down to 48x48 pixels with GIMP's "Cubic" interpolation, I get this:
![Morgan_Freeman_1998_48x48px_GIMP_cubic](/uploads/4db0bd43ed11f7360fa72f3bcfcd29b4/Morgan_Freeman_1998_48x48px_GIMP_cubic.png) ![Woman_in_Eyeglasses_48x48_GIMP_cubic](/uploads/683461cf947274f684b96a703035f4bf/Woman_in_Eyeglasses_48x48_GIMP_cubic.png)
...somewhat similar results with "NoHalo" interpolation:
![Morgan_Freeman_1998_48x48px_GIMP_nohalo](/uploads/6a0373448d04aa7f246b7c9cd39fcf23/Morgan_Freeman_1998_48x48px_GIMP_nohalo.png) ![Woman_in_Eyeglasses_48x48_GIMP_nohalo](/uploads/b527c8d3a8737e0121590bf163406e00/Woman_in_Eyeglasses_48x48_GIMP_nohalo.png)
If you open the above sample in a new browser window and resize the window small enough to match, you get even better (yet still somewhat similar) results, on the fly:
![image](/uploads/dd78c89e940daf6bbd67f191d5e1f321/image.png)
![Screenshot_from_2023-07-24_18-21-48](/uploads/58f51e1a417c79109715722221c696d5/Screenshot_from_2023-07-24_18-21-48.png)
...but if you scale it by loading it into GTK4-demo's "Image Scaling" demo, and then set the scaling type to Trilinear, you get:
![Screenshot_from_2023-07-24_17-37-41](/uploads/0158a53816678bcd59bb0872687a096c/Screenshot_from_2023-07-24_17-37-41.png)
Here, you could mistakenly think this is Eddie rather than Morgan.
But the blurriness is even more noticeable with the young lady's picture:
![Screenshot_from_2023-07-24_18-15-35](/uploads/8ff5f6fb696b10a6759a96a473afded7/Screenshot_from_2023-07-24_18-15-35.png)