Bug 483876 - Spectacle takes blurry screenshots depending on the window position on Wayland with 1.5 fractional scale
Summary: Spectacle takes blurry screenshots depending on the window position on Waylan...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: compositing (show other bugs)
Version: 6.0.2
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: qt6, wayland
Depends on:
Blocks:
 
Reported: 2024-03-18 01:13 UTC by zvova7890
Modified: 2024-05-24 00:47 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0.5


Attachments
Clear screenshot (257.73 KB, image/png)
2024-03-18 01:18 UTC, zvova7890
Details
Blurred screenshot (356.75 KB, image/png)
2024-03-18 01:19 UTC, zvova7890
Details
Zoom comparison (62.85 KB, image/png)
2024-03-18 01:19 UTC, zvova7890
Details

Note You need to log in before you can comment on or make changes to this bug.
Description zvova7890 2024-03-18 01:13:48 UTC
SUMMARY:
I was trying to figure out why Spectacle is getting blurred screenshots and discovered an interesting problem, and now Spectacle is not guilty. Apparently, KWin has some rounding-related issues when it creates an image from the surface (window). It seems that when the window position can't be divided by the scale factor into an integer value, KWin returns a little bit blurred screenshot, which Spectacle saves as it comes. Maybe it also depends on the window size, but I'm not sure.

STEPS TO REPRODUCE:
1. Set the scale factor to 1.5.
2. Open some window, for example Konsole.
3. Put it at the 0x0 coordinates (top-left corner). Also, for just in case, ensure that the current window size can be divided by 1.5 without problems.
4. Take a screenshot and save it as a file.
5. Then move this window to somewhere to achieve an XY value that can't be divided by 1.5.
6. Take another screenshot and save it as a file.
7. Open it in GIMP and compare font glyphs.

OBSERVED RESULT
The screenshot is blurred

EXPECTED RESULT
Crystal clear screenshot whatever coordinates it was

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.2
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.8.1-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 9 7940HS w/ Radeon 780M Graphics
Memory: 28,2 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: Micro Computer (HK) Tech Limited
Product Name: Venus series
Comment 1 zvova7890 2024-03-18 01:18:56 UTC
Created attachment 167392 [details]
Clear screenshot
Comment 2 zvova7890 2024-03-18 01:19:24 UTC
Created attachment 167393 [details]
Blurred screenshot
Comment 3 zvova7890 2024-03-18 01:19:45 UTC
Created attachment 167394 [details]
Zoom comparison
Comment 4 Bug Janitor Service 2024-03-24 20:24:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5516
Comment 5 Nick 2024-03-24 21:09:13 UTC
I can duplicate this on Neon 6.0.2 Wayland with the instructions provided. Thanks.
Comment 6 Nate Graham 2024-04-04 19:47:58 UTC
Noah, is this different from Bug 478426?
Comment 7 Noah Davis 2024-04-04 19:58:59 UTC
(In reply to Nate Graham from comment #6)
> Noah, is this different from Bug 478426?

yes
Comment 8 Nate Graham 2024-05-20 16:35:20 UTC
This is fixed with the commits in https://invent.kde.org/plasma/kwin/-/merge_requests/5516, authored by Volodymyr Zolotopupov. They'll appear in Plasma 6.0.5
Comment 9 zvova7890 2024-05-20 18:04:50 UTC
Yep, that's me :) 
Thanks for the merge!