You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: 'Copy image' on a thread image re-encodes it and strips PNG metadata (tEXt/iTXt); file copy/attach keeps it #41041
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/desktop
Steps to reproduce
Get a PNG that carries ancillary text chunks into a thread, so it shows as an image thumbnail. For example, use a tEXt chunk with keyword test and value METADATA-SURVIVED, plus an iTXt chunk.
Open the thumbnail and choose right-click → Copy image.
Paste into the composer with Ctrl+V and send.
Inspect the saved attachment under ~/.t3/userdata/attachments/, for example with strings file.png | grep SURVIVED or by listing the PNG chunks.
For comparison, copy the same PNG file in a file manager (such as Dolphin) and paste it, or attach it with the file picker.
Expected behavior
Copy image on an image in T3 copies the original image bytes. Pasting it back then stores the same file, ancillary chunks (tEXt/iTXt/zTXt) included, as when the file is copied from a file manager or attached.
Actual behavior
After Copy image in T3: the pasted attachment is re-encoded. It has only IHDR, IDAT, IDAT and IEND, every tEXt/iTXt chunk is dropped, and the size changes (581 bytes → 522 bytes). The decoded pixels are bit-identical.
File copied from Dolphin, or attached with the file picker: stored byte-identical, with the metadata intact.
Placed on the clipboard with wl-copy --type image/png: the bytes round-trip with an identical hash.
So the loss happens in T3's Copy image action. It probably copies the decoded bitmap, Chromium's default copy-image behaviour, rather than the original file bytes. Writing the original image/png bytes, or the file itself, to the clipboard would fix it.
Impact
Minor bug or occasional failure
Version or commit
t3 v0.1.10-nightly.20261116.4800
Environment
Linux (CachyOS, kernel 7.x), Wayland session, T3 Code desktop app, Claude provider
Workaround
Copy the PNG file from a file manager, or attach it with the file picker, instead of using Copy image in T3.
Why it matters
Tools can embed machine-readable context in PNG text chunks so that an agent receiving a pasted screenshot knows exactly where it came from. One example is a note-editor "lasso" screenshot carrying note IDs and a project reference. Copying an image out of a thread and pasting it back is a natural way to pass such screenshots around, but the re-encode silently removes that context.
@raiscan After wl-copy --type image/png < test.png, does wl-paste --type image/png | sha256sum match sha256sum test.png, and is a clipboard manager such as Klipper running? If the hashes differ, the clipboard contents are being replaced before T3 reads them.
Yes, the hashes match. The clipboard keeps the original bytes:
$ sha256sum test.png
a31a71bf0dfd0f17… test.png
$ wl-copy --type image/png < test.png
$ wl-paste --list-types
image/png
$ wl-paste --type image/png | sha256sum # checked after 1 s, 4 s and 20 s
a31a71bf0dfd0f17… -
Klipper is running, as part of plasmashell 6.8.3 on KDE Plasma (Wayland). It only advertises image/png and doesn't replace the contents: the hash stayed identical for at least 20 s.
So the original bytes, tEXt/iTXt chunks included, are still on the clipboard when T3 reads it. The stored attachment was still re-encoded (581 → 522 bytes, ancillary chunks gone, pixels identical).
Correction: my original steps were wrong. The paste path is fine. The metadata is lost when the image is copied out of T3. Here is the exact sequence:
The PNG (with tEXt/iTXt chunks) appeared in the thread as an image thumbnail.
I opened the thumbnail and chose right-click → Copy image.
I pasted that into the composer. The stored attachment was re-encoded: 581 → 522 bytes, ancillary chunks gone, pixels identical.
Comparisons:
Copying the same PNG file in a file manager (Dolphin) and pasting it into the composer keeps it byte-identical, metadata included.
Attaching the file with the file picker also keeps it byte-identical.
wl-copy --type image/png < test.png round-trips with an identical hash, as in my previous comment.
So Copy image in T3's image viewer appears to put a re-encoded bitmap on the clipboard (Chromium's default copy-image behaviour) rather than the original file bytes. A fix would be to copy the original image/png bytes, or the file itself, for attachments. I'll update the title and steps to match.
changed the title [-][Bug]: Pasting a PNG into the composer strips its metadata (tEXt/iTXt chunks); attaching the same file keeps it[/-][+][Bug]: 'Copy image' on a thread image re-encodes it and strips PNG metadata (tEXt/iTXt); file copy/attach keeps it[/+]on Nov 22, 2026
Confirmed: pasting the raw image/png clipboard (put there with wl-copy) into the composer stores the attachment byte-identical: same SHA-256, tEXt/iTXt intact. The paste path is fine. The metadata is only lost when the clipboard came from T3's Copy image on a thread image.
Source dive (at 7e3a9ba). Both paths in apps/desktop/src/window/ContextMenuImage.ts, called from the Copy Image item in DesktopWindow.ts, re-encode the image:
Main frame (line 13):contents.copyImageAt(params.x, params.y) puts Chromium's decoded bitmap on the clipboard, and that's written back out as a fresh PNG. Thread thumbnails take this path, so ancillary chunks are lost.
Sub-frames (lines 67–95): this path already fetches the original bytes, but then runs nativeImage.createFromBuffer(bytes).toPNG() (or a canvas convertToBlob fallback), which re-encodes them. Only the decoded pixels survive.
Suggested fix: once the bytes are fetched, if they're already a PNG (8-byte signature check), write them unchanged:
Then route main-frame images through the same fetch-and-pass-through path, using params.srcURL (the attachment/asset URL), instead of copyImageAt. Keep copyImageAt only as a fallback for sources that can't be fetched. The existing size and dimension checks still apply, because the dimensions come from the header.
Activity
juliusmarminge commentedon Nov 22, 2026
@raiscan After
wl-copy --type image/png < test.png, doeswl-paste --type image/png | sha256summatchsha256sum test.png, and is a clipboard manager such as Klipper running? If the hashes differ, the clipboard contents are being replaced before T3 reads them.raiscan commentedon Nov 22, 2026
Yes, the hashes match. The clipboard keeps the original bytes:
Klipper is running, as part of plasmashell 6.8.3 on KDE Plasma (Wayland). It only advertises
image/pngand doesn't replace the contents: the hash stayed identical for at least 20 s.So the original bytes,
tEXt/iTXtchunks included, are still on the clipboard when T3 reads it. The stored attachment was still re-encoded (581 → 522 bytes, ancillary chunks gone, pixels identical).raiscan commentedon Nov 22, 2026
Correction: my original steps were wrong. The paste path is fine. The metadata is lost when the image is copied out of T3. Here is the exact sequence:
tEXt/iTXtchunks) appeared in the thread as an image thumbnail.Comparisons:
wl-copy --type image/png < test.pnground-trips with an identical hash, as in my previous comment.So Copy image in T3's image viewer appears to put a re-encoded bitmap on the clipboard (Chromium's default copy-image behaviour) rather than the original file bytes. A fix would be to copy the original
image/pngbytes, or the file itself, for attachments. I'll update the title and steps to match.[-][Bug]: Pasting a PNG into the composer strips its metadata (tEXt/iTXt chunks); attaching the same file keeps it[/-][+][Bug]: 'Copy image' on a thread image re-encodes it and strips PNG metadata (tEXt/iTXt); file copy/attach keeps it[/+]raiscan commentedon Nov 22, 2026
Confirmed: pasting the raw
image/pngclipboard (put there withwl-copy) into the composer stores the attachment byte-identical: same SHA-256,tEXt/iTXtintact. The paste path is fine. The metadata is only lost when the clipboard came from T3's Copy image on a thread image.raiscan commentedon Nov 22, 2026
Source dive (at 7e3a9ba). Both paths in
apps/desktop/src/window/ContextMenuImage.ts, called from the Copy Image item inDesktopWindow.ts, re-encode the image:contents.copyImageAt(params.x, params.y)puts Chromium's decoded bitmap on the clipboard, and that's written back out as a fresh PNG. Thread thumbnails take this path, so ancillary chunks are lost.nativeImage.createFromBuffer(bytes).toPNG()(or a canvasconvertToBlobfallback), which re-encodes them. Only the decoded pixels survive.Suggested fix: once the bytes are fetched, if they're already a PNG (8-byte signature check), write them unchanged:
Then route main-frame images through the same fetch-and-pass-through path, using
params.srcURL(the attachment/asset URL), instead ofcopyImageAt. KeepcopyImageAtonly as a fallback for sources that can't be fetched. The existing size and dimension checks still apply, because the dimensions come from the header.