Bug 375824

Summary: Wallpaper image size choice is not optimal
Product: [Plasma] plasmashell Reporter: Chris Spiegel <cspiegel>
Component: Image WallpaperAssignee: Marco Martin <notmart>
Status: RESOLVED FIXED    
Severity: minor CC: nate, plasma-bugs
Priority: NOR    
Version: 5.9.0   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Chris Spiegel 2017-01-31 23:55:30 UTC
Wallpapers can include many different image resolutions to better match monitor reoslutions.  When choosing which image size to use, an algorithm is used which takes into account both the aspect ratio as well as how much larger or smaller the image is than the monitor resolution.  Smaller images are penalized doubly: an image which is 200 pixels narrower than the desired image is counted the same as an image which is 400 pixels wider.

I believe this algorithm is suboptimal: given a monitor size of 1920x1200, and a wallpaper with two image sizes, 1680x1050 and 2560x1600, the smaller image is chosen even though both have identical aspect ratios to the original.

The problem with this is that upscaling an image looks worse than downscaling an image, as sharpness is inevitably lost.  In plasma-workspace/wallpapers/image/image.cpp, in the function “distance”, the following is the responsible code:

delta = (delta >= 0.0 ? delta : -delta*2 ); // Penalize for scaling up

I think that it's probably better to *always* prefer the larger image if the aspect ratio is the same, but in any case, I think the multiplier here for penalizing upscaling should at least be greater so that images which are somewhat larger, but the same aspect ratio, are prioritized over smaller images of the same aspect ratio.  In my case, a multiplier of 4 is sufficient, so that 2560x1600 is used on my 1920x1200 monitors, but again, I think it's probably better to err a lot on the side of significantly larger images.
Comment 1 Nibaldo G. 2017-02-16 05:14:35 UTC
I was just going to report this bug and I found it. I noticed that the wallpapers look rather blurry.

As an example, if we choose this wallpaper image on a regular monitor, the bug is notorious:
https://kbdevstorage1.blob.core.windows.net/asset-blobs/19027_en_1
Comment 2 Nate Graham 2020-10-05 20:09:30 UTC
This was fixed recently for Plasma 5.20 IIRC.