Bug 507640 - PNG encoding issue in Spectacle while copying data to the Plasmashell Clipboard
Summary: PNG encoding issue in Spectacle while copying data to the Plasmashell Clipboard
Status: REPORTED
Alias: None
Product: Spectacle
Classification: Applications
Component: General (other bugs)
Version First Reported In: 6.4.3
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Noah Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-29 17:29 UTC by kderazorback
Modified: 2025-08-19 19:54 UTC (History)
5 users (show)

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


Attachments
Journald screenshot (207.41 KB, image/png)
2025-07-29 17:29 UTC, kderazorback
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kderazorback 2025-07-29 17:29:34 UTC
Created attachment 183638 [details]
Journald screenshot

SUMMARY
There is an error introduced in version 6.4.3 of spectacle while copying image data to the clipboard. It seems to be a PNG encoding issue on Spectacle's side that prevents plasmashell from decoding it.

STEPS TO REPRODUCE
1. Open Spectacle tool (via any way, K menu or PrintScr option) and select a display portion to copy to the clipboard.
2. Press Ctrl+C to copy the selected area to the clipboard.
3. Try to paste the image into any app, for example Dolphin, Krita, Telegram, etc.
4. Around half of the time, the image will silently fail to be pasted. Like nothing is on the clipboard.
5. Run `journalctl -xe --user`. when the copy operation fails you will see errors between Spectacle and Plasmashell failing to copy the image into the clipboard.

OBSERVED RESULT

When taking an screenshot, it doesnt matter if its a whole display or a portion, if the image is set to be copied into the clipboard it fail to be copied around 50% of the time.
The error seems to be a PNG encoding issue. When the copy operation fails there is an error log in the user's journal. 
```text
ul 29 18:38:52 PLATINUM plasmashell[2801]: DataControlOffer: timeout reading from pipe for mimeType application/x-qt-image
jul 29 18:38:52 PLATINUM spectacle[278131]: Failed to send all clipobard data; sent -1 bytes out of 5891351
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: qrc:/qt/qml/org/kde/plasma/private/clipboard/ImageItemDelegate.qml:26:9: QML Image: Cannot open: file:///home/kderazorback/.local/share/klipper/data/9c52b7bc5f0cf645dc2a47033d1adee97c420314/9c52b7bc5f0cf645dc2a47033d1adee97c420314
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: TGAHandler::canRead() error while reading the header
jul 29 18:38:52 PLATINUM plasmashell[2801]: qrc:/qt/qml/org/kde/plasma/private/clipboard/ImageItemDelegate.qml:26:9: QML Image: Error decoding: file:///home/kderazorback/.local/share/klipper/data/da39a3ee5e6b4b0d3255bfef95601890afd80709/da39a3ee5e6b4b0d3255bfef95601890afd80709: Unsupported image format
jul 29 18:38:54 PLATINUM kwin_wayland[2583]: kwin_scene_opengl: Could not delete texture because no context is current
jul 29 18:39:00 PLATINUM plasmashell[2801]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
jul 29 18:39:00 PLATINUM Telegram[30703]: QWaylandDataOffer: timeout reading from pipe
jul 29 18:39:00 PLATINUM Telegram[30703]: QWaylandDataOffer: error reading data for mimeType application/x-qt-image
jul 29 18:39:01 PLATINUM spectacle[278131]: Failed to send all clipobard data; sent -1 bytes out of 5891351
jul 29 18:39:01 PLATINUM Telegram[30703]: QWaylandDataOffer: timeout reading from pipe
jul 29 18:39:01 PLATINUM Telegram[30703]: QWaylandDataOffer: error reading data for mimeType image/png
jul 29 18:39:01 PLATINUM plasmashell[2801]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
jul 29 18:39:02 PLATINUM spectacle[278131]: Failed to send all clipobard data; sent -1 bytes out of 5891351
jul 29 18:39:02 PLATINUM Telegram[30703]: QWaylandDataOffer: timeout reading from pipe
jul 29 18:39:02 PLATINUM Telegram[30703]: QWaylandDataOffer: error reading data for mimeType image/avif
jul 29 18:39:02 PLATINUM spectacle[278131]: Failed to send all clipobard data; sent -1 bytes out of 382283
```
If the clipboard history is opened with Win+V, it will recognize the copied entry as a empty, preventing its selection/paste.

WORKAROUND
Set up spectacle to keep its window open after screenshot, after confirming the screenshot, wait for the preview/results popup and then press Ctrl+C a couple of times to guarantee its actually copied to the clipboard. This will brute-force the copy action until it works.


EXPECTED RESULT
The image should be copied every time Ctrl+C is pressed while capturing the screen or while doing the shortcut on the Spectacle preview window.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE neon User Edition
KDE Plasma Version: 6.4.3
KDE Frameworks Version: 6.16.0
Qt Version: 6.9.1
Kernel Version: 6.14.0-24-generic (64-bit)
Graphics Platform: Wayland
Processors: 24 × 13th Gen Intel® Core™ i7-13700
Memory: 64 GiB of RAM (62.5 GiB usable)
Graphics Processor 1: Intel® Graphics
Graphics Processor 2: AMD Radeon RX 6700 XT

Package: kde-spectacle
Version: 1:6.4.3-0zneon+24.04+noble+release+build38

At the time of filling the bug there is no more recent version of Spectacle available.

ADDITIONAL INFORMATION
This was introduced in KDE with the latest big update made to Spectacle.
I searched the bug board here but other entries seem to be related to other similar errors with different causes, so I'm creating a new one specifically mentioning the PNG encoding issue.

The only ticket I could find that may be the same issue is: https://bugs.kde.org/show_bug.cgi?id=506781
But I'm not exactly sure since it does not contain too many details and even when confirmed no detail was provided by the assignee.

By the way, there is also a typo in the error message logged by spectacle to the journal. It says `clipobard` instead of `clipboard`. This is a minor issue but solving it would make `grepping` the journal a lot easier.
Comment 1 David Edmundson 2025-07-30 16:17:33 UTC
Relevant line is this:

jul 29 18:38:52 PLATINUM spectacle[278131]: Failed to send all clipobard data; sent -1 bytes out of 5891351

Which implies one of plasmashell or spectacle got stuck a bit when it was meant to be transferring and then plasmashell timed out.
Comment 2 kderazorback 2025-08-02 15:38:40 UTC
Im investigating a little bit on this and found out some weird behaviour, that I think its related. But Im not able to reproduce the exact error message: `Failed to send all clipobard data; sent -1 bytes out of 5891351` in a reliably way.

If I take an screenshot on Spectacle for an small window region (500x500px or so) it works perfectly and the image is copied to the plasmashell clipboard without issues. Nothing weird logged on journald.

If I copy instead a bigger window region (about 2560x1440px, my entire display res), almost all the time Spectacle will fail to put the image into the plasmashell clipboard and the following errors appear on the user's journald:

```text
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/ImageItemDelegate.qml:26:9: QML Image: Error decoding: file:///home/kderazorback/.local/share/klipper/data/da39a3ee5e6b4b0d3255bfef95601890afd80709/da39a3ee5e6b4b0d3255bfef95601890afd80709: Unsupported image format
ago 02 17:30:58 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:30:58 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:30:58 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:30:58 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:30:58 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:30:58 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/ImageItemDelegate.qml:26:9: QML Image: Error decoding: file:///home/kderazorback/.local/share/klipper/data/da39a3ee5e6b4b0d3255bfef95601890afd80709/da39a3ee5e6b4b0d3255bfef95601890afd80709: Unsupported image format
ago 02 17:30:58 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/UrlItemDelegate.qml:49:17: TypeError: Cannot read property 'height' of null
ago 02 17:30:58 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/UrlItemDelegate.qml:49:17: TypeError: Cannot read property 'height' of null
ago 02 17:30:58 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/UrlItemDelegate.qml:49:17: TypeError: Cannot read property 'height' of null
ago 02 17:30:58 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/UrlItemDelegate.qml:49:17: TypeError: Cannot read property 'height' of null
ago 02 17:30:58 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/UrlItemDelegate.qml:49:17: TypeError: Cannot read property 'height' of null
```

But what is more interesting, if I open Gwenview, and open a big png image (5400x2700 pixels) and pressed Ctrl+C once, it works properly and copies the image to the plasmashell's clipboard. BUT if I pressed it multiple times in quick succession, the exact same error appears constantly on the systemd's journal and the image it not copied at all.

```text
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/ImageItemDelegate.qml:26:9: QML Image: Error decoding: file:///home/kderazorback/.local/share/klipper/data/da39a3ee5e6b4b0d3255bfef95601890afd80709/da39a3ee5e6b4b0d3255bfef95601890afd80709: Unsupported image format
ago 02 17:33:59 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:33:59 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:33:59 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:33:59 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:33:59 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:33:59 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/ImageItemDelegate.qml:26:9: QML Image: Error decoding: file:///home/kderazorback/.local/share/klipper/data/da39a3ee5e6b4b0d3255bfef95601890afd80709/da39a3ee5e6b4b0d3255bfef95601890afd80709: Unsupported image format
ago 02 17:34:00 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "BM\x96k"
ago 02 17:34:00 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:34:00 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:34:00 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:34:00 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:34:00 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:34:00 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:34:00 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:34:00 PLATINUM plasmashell[3207]: TGAHandler::canRead() error while reading the header
ago 02 17:34:00 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/ImageItemDelegate.qml:26:9: QML Image: Error decoding: file:///home/kderazorback/.local/share/klipper/data/da39a3ee5e6b4b0d3255bfef95601890afd80709/da39a3ee5e6b4b0d3255bfef95601890afd80709: Unsupported image format
ago 02 17:34:00 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:34:00 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:34:00 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:34:00 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:34:00 PLATINUM plasmashell[3207]: IFFChunk::innerFromDevice: unkwnown chunk "\x89PNG"
ago 02 17:34:00 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/UrlItemDelegate.qml:49:17: TypeError: Cannot read property 'height' of null
ago 02 17:34:00 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/UrlItemDelegate.qml:49:17: TypeError: Cannot read property 'height' of null
ago 02 17:34:00 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/UrlItemDelegate.qml:49:17: TypeError: Cannot read property 'height' of null
ago 02 17:34:00 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/UrlItemDelegate.qml:49:17: TypeError: Cannot read property 'height' of null
ago 02 17:34:00 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/UrlItemDelegate.qml:49:17: TypeError: Cannot read property 'height' of null
ago 02 17:34:00 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/UrlItemDelegate.qml:49:17: TypeError: Cannot read property 'height' of null
ago 02 17:34:00 PLATINUM plasmashell[3207]: qrc:/qt/qml/org/kde/plasma/private/clipboard/UrlItemDelegate.qml:49:17: TypeError: Cannot read property 'height' of null
```

I think this bug needs to be assigned to Plasmashell instead.

For the sake of completion, this is the last output of KInfo:
KDE Plasma Version: 6.4.3
KDE Frameworks Version: 6.16.0
Qt Version: 6.9.1
Kernel Version: 6.14.0-27-generic (64-bit)
Graphics Platform: Wayland
Processors: 24 × 13th Gen Intel® Core™ i7-13700
Memory: 64 GiB of RAM (62.5 GiB usable)
Graphics Processor 1: Intel® Graphics
Graphics Processor 2: AMD Radeon RX 6700 XT

And I'm using Gwenview 25.04.3