Bug 466026

Summary: Spectacle screenshot scales cross-monitor content with artifacts
Product: [Applications] Spectacle Reporter: Ye Jingchen <ye.jingchen>
Component: GeneralAssignee: Boudhayan Gupta <me>
Status: RESOLVED FIXED    
Severity: normal CC: kde, nate, noahadvs
Priority: NOR    
Version First Reported In: 22.12.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 24.05
Sentry Crash Report:
Attachments: cross monitor screenshot, left@2x, right@1.5x

Description Ye Jingchen 2023-02-18 18:52:15 UTC
Created attachment 156454 [details]
cross monitor screenshot, left@2x, right@1.5x

SUMMARY
(This is continued from https://bugs.kde.org/show_bug.cgi?id=460675, but might not be related)

I have two monitors side by side, the left one scaled at 200%, the right one 150%. If Spectacle capture a rectangle region screenshot containing parts from both monitors, the part containing 150% monitor is scaled with artifacts not present on screen.

If the rectangle is entirely within either monitor, the result is the same as on screen.

STEPS TO REPRODUCE
1. Create the above monitor setup.
2. Open a integer scaled window (Dolphin or Gwenview, which doesn't support the new fractional-scale protocol yet), put it across monitor border.
3. Use spectacle to capture a rectangle region containing the window above, across monitor border.
4. Save and see the resulting screenshot without scaling **on a integer scaled monitor** 

OBSERVED RESULT
The right half (from 150% scaled monitor) contains weird artifacts, especially on texts. (See attachment "left@2x, right@1.5x.png")

EXPECTED RESULT
The right half should match as closely as possible to what is seen to the eye, without those artifacts.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
KDE Plasma Version: 5.27.0
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION
I just realized when experimenting with Spectacle, that in order for the window to maintain its shape across monitors in screenshot, some scaling must be done after capturing both monitors. So the resulting artifacts on the right half is (probably) caused by Spectacle scaling up the 150% half, which is already scaled down from 200% by kwin, to match the 200% half. The only problem is the scaling algorithm that introduced those artifacts.
Comment 1 Vlad Zahorodnii 2023-02-20 08:59:13 UTC
Not sure that there's a feasible solution. We're dealing with mismatching scaling factors, there will be seams between screens because of the magnification filter.
Comment 2 Nate Graham 2024-04-19 07:02:24 UTC
This should be substantially improved if not fixed with the upcoming 24.05 release. Please do feel free to re-open the bug report if you find that it's not fixed for you though, and we'll do more investigation.
Comment 3 Ye Jingchen 2024-04-20 08:14:40 UTC
It seems spectacle 24.02.2 already improved a lot, presumably by apps switching to Qt 6 and supporting fractional scaling. I will check again when 24.05 released and with various other apps.