Bug 499363 - Size and position of emblem icon depends on thumbnail's dimensions
Summary: Size and position of emblem icon depends on thumbnail's dimensions
Status: CONFIRMED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Desktop icons & Folder View widget (other bugs)
Version First Reported In: master
Platform: Other Linux
: NOR minor
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-31 17:36 UTC by Thomas Moerschell
Modified: 2025-02-24 21:46 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Issue with old KIconUtils (33.24 KB, image/png)
2025-01-31 17:36 UTC, Thomas Moerschell
Details
Issue with latest KIconUtils (28.38 KB, image/png)
2025-01-31 17:36 UTC, Thomas Moerschell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Moerschell 2025-01-31 17:36:09 UTC
Created attachment 177853 [details]
Issue with old KIconUtils

SUMMARY
Overlays on icons, such as soft link overlays, have inconsistent sizes depending on the preview format. A recent fix in KIconUtils (https://invent.kde.org/frameworks/kguiaddons/-/merge_requests/164) also broke those icons some more (base icons are now too small), see attached screenshots.

STEPS TO REPRODUCE
Create symbolic links on your desktop to files with icons of different aspect ratios.
Here's a short script that automates that:
```
cd $HOME/Desktop

declare -A images
images=(
    ["16_9.png"]="1920x1080"
    ["4_3.png"]="1024x768"
    ["1_1.png"]="1000x1000"
    ["21_9.png"]="2560x1080"
)

for img in "${!images[@]}"; do
    magick -size "${images[$img]}" xc:white "$img"
    ln -s "$img" "link_$img"
done
```

OBSERVED RESULT
The overlay does not have a consistent size and position.
The link icons have a smaller base icon than the originals.

EXPECTED RESULT
The link icons are the same as the original icons, with the same link overlay for all

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20250128
KDE Plasma Version: 6.3.80
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.1

ADDITIONAL INFORMATION
See BUG 498211 and https://invent.kde.org/system/dolphin/-/merge_requests/889
"Some of what https://invent.kde.org/system/dolphin/-/merge_requests/889 did will be needed (enlarge the icon size to maximum available size instead of the source image size scaled)."
Comment 1 Thomas Moerschell 2025-01-31 17:36:57 UTC
Created attachment 177854 [details]
Issue with latest KIconUtils
Comment 2 Bug Janitor Service 2025-02-04 09:27:32 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kguiaddons/-/merge_requests/168
Comment 3 Méven 2025-02-07 12:23:17 UTC
Git commit 5f62220b4ede5b92f862303abfc82c95a8375e30 by Méven Car.
Committed on 04/02/2025 at 09:23.
Pushed by nicolasfella into branch 'master'.

KIconUtils: simplify addOverlay implementation

It seems we can in fact QIcon::paint and get correct output even with a
scaling ratio.

M  +1    -7    src/util/kiconutils.cpp

https://invent.kde.org/frameworks/kguiaddons/-/commit/5f62220b4ede5b92f862303abfc82c95a8375e30
Comment 4 Thomas Moerschell 2025-02-07 23:53:59 UTC
Thank Meven! As mentioned in the MR, this has only partially solved the issue. Should I open a new Bug? I do agree that it might be rather low priority, now that it looks normal again.
Comment 5 Méven 2025-02-12 10:05:49 UTC
(In reply to Thomas Moerschell from comment #4)
> Thank Meven! As mentioned in the MR, this has only partially solved the
> issue. Should I open a new Bug? I do agree that it might be rather low
> priority, now that it looks normal again.

I don't think that's necessary, in dolphin, this is already fixed for 25.04 https://invent.kde.org/system/dolphin/-/merge_requests/889
Comment 6 Thomas Moerschell 2025-02-12 10:36:13 UTC
Yes, however this is about Plasma shell, the icons on the desktop.
Comment 7 Méven 2025-02-24 11:15:15 UTC
This is not a regression AFAICT.

KIconUtils::addoverlays, scales the overly size based on its input size.
This only looks good for square images.

In dolphin, we are stopping to use this function https://invent.kde.org/system/dolphin/-/merge_requests/917 to use an overlay size based on the target output size of the icon, not on its input.

KIconUtils could have an additional parameter/setter to allow this.