Bug 488034 - Spectacle toolbar shows wrong pixel size during region selection (Wayland fractional scaling)
Summary: Spectacle toolbar shows wrong pixel size during region selection (Wayland fra...
Status: RESOLVED FIXED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (other bugs)
Version First Reported In: 6.3.1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Noah Davis
URL:
Keywords:
: 491991 510569 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-06-04 18:44 UTC by Andrea Ippolito
Modified: 2026-02-05 02:14 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.6.0
Sentry Crash Report:


Attachments
Shows the wrong pixel values for various global scale % (51.42 KB, image/png)
2024-12-14 13:30 UTC, ato300
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrea Ippolito 2024-06-04 18:44:49 UTC
Spectacle's toolbar while capturing a screenshot via the region selection feature shows a wrong pixel size for the selected area.

STEPS TO REPRODUCE

Internal display is enough to reproduce this one.

My laptop's display has a resolution of 2256x1504, but I scale it at 125% (setting a scale factor is crucial to reproduce)

Launch spectacle and choose the region screenshot feature. Now drag a rectangle and check the pixel size the toolbar shows for the selected area: it is probably much higher than the actual pixel count. To prove this, you can just draw a rectangle from the top left to the bottom right corner of the screen, and you will see an exaggerated pixel size for it. In my case at 125% it says "3609x2405" (which isn't even native resolution * 1.25, by quite a margin).

The captured image has the correct resolution, though (2256x1504).
Comment 1 Andrea Ippolito 2024-06-04 19:13:25 UTC
Working fine of course at 100%, but also at 200%.
Comment 2 ato300 2024-12-14 13:30:24 UTC
Created attachment 176600 [details]
Shows the wrong pixel values for various global scale %

I can reproduce this on Kubuntu 24.10 (Plasma 6.1.5, Frameworks 6.6.0, Qt 6.6.2), Wayland, on a 2K monitor (2560x1440).

I tested various global scale percentages and I believe I found the "formula" of the error.

On 100%, 200%, 300% pixels are reported correctly. 

In the attached table, I've shown the reported pixels when I select the rectangular region to be as large as possible (i.e. to encompass the whole screen) and I compared that with the expected resolution. Small rounding errors are possible.

So for the fractional global scale values it seems that the number of pixels displayed is A times larger than expected, where A is computed as:

A = CEIL(GlobalScale) / GlobalScale
Comment 3 ato300 2024-12-14 13:44:03 UTC
*** Bug 491991 has been marked as a duplicate of this bug. ***
Comment 4 Andrea Ippolito 2025-03-03 11:02:44 UTC
Still happening with Spectacle 6.3.1
Comment 5 Andrea Ippolito 2025-03-03 11:05:01 UTC
Also, when reaching the boundaries of the screen while drawing a rectangular selection, the popup showing the dimensions disappears as its kicked out of screen boundaries. It should move dynamically (or always be displayed inside the rectangle?)
Comment 6 Noah Davis 2026-02-03 06:42:19 UTC
*** Bug 510569 has been marked as a duplicate of this bug. ***
Comment 7 Bug Janitor Service 2026-02-03 07:04:08 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/spectacle/-/merge_requests/506
Comment 8 Noah Davis 2026-02-04 00:22:52 UTC
Git commit e63c14c3d32c0a610470f3000298e891bbc48b68 by Noah Davis.
Committed on 03/02/2026 at 20:40.
Pushed by ndavis into branch 'master'.

CaptureOverlay: Fix sizes in size tooltips with screen scales smaller than the largest

Previously, displayed selection sizes were based on the region of the internal
combined screens image that was selected for screenshots or the largest of all
screen scales for screencasts. That seemed a bit strange to users who wouldn't
have any clue about how spectacle works internally and was just wrong about the
final output sometimes. Now we try to show sizes based on the screen scales that
overlap with the selection.

For screenshots, Spectacle tries to scale the image of the region to the
original screen scale if the region is only in an area with one scale. If
there are multiple scales, especially fractional scales, the image may be
larger than expected to some users due to Spectacle upscaling to an integer
scale. Upscaling to integers is done to preserve the crispness of integer
scale screens since fractional scale screens will typically have some issues
with blurriness anyway.

For screencasts, we use the largest screen scale overlapping with the selected region.

M  +51   -36   src/Gui/CaptureOverlay.qml
M  +1    -1    src/Gui/SizeLabel.qml

https://invent.kde.org/plasma/spectacle/-/commit/e63c14c3d32c0a610470f3000298e891bbc48b68
Comment 9 Noah Davis 2026-02-04 00:33:44 UTC
Git commit 666f1171c09eff4bf50fd242a12a39ebb215e205 by Noah Davis.
Committed on 04/02/2026 at 00:29.
Pushed by ndavis into branch 'Plasma/6.6'.

CaptureOverlay: Fix sizes in size tooltips with screen scales smaller than the largest

Previously, displayed selection sizes were based on the region of the internal
combined screens image that was selected for screenshots or the largest of all
screen scales for screencasts. That seemed a bit strange to users who wouldn't
have any clue about how spectacle works internally and was just wrong about the
final output sometimes. Now we try to show sizes based on the screen scales that
overlap with the selection.

For screenshots, Spectacle tries to scale the image of the region to the
original screen scale if the region is only in an area with one scale. If
there are multiple scales, especially fractional scales, the image may be
larger than expected to some users due to Spectacle upscaling to an integer
scale. Upscaling to integers is done to preserve the crispness of integer
scale screens since fractional scale screens will typically have some issues
with blurriness anyway.

For screencasts, we use the largest screen scale overlapping with the selected region.
(cherry picked from commit e63c14c3d32c0a610470f3000298e891bbc48b68)

M  +51   -36   src/Gui/CaptureOverlay.qml
M  +1    -1    src/Gui/SizeLabel.qml

https://invent.kde.org/plasma/spectacle/-/commit/666f1171c09eff4bf50fd242a12a39ebb215e205