Skip to content

Fix: Copy image to clipboard not working on Electron 44 and later - #674

Merged
ollm merged 1 commit into
ollm:masterfrom
mateuscmtropical:fix/copy-image-clipboard
Nov 20, 2026
Merged

ollm merged 1 commit into
ollm:masterfrom
mateuscmtropical:fix/copy-image-clipboard

Conversation

@mateuscmtropical

Copy link
Copy Markdown
Contributor

Fixes #672

Electron 44 removed the clipboard module from renderer processes (breaking changes), and also removed clipboard.writeImage from the main process. So with Electron 45, electron.clipboard is undefined in copyImageToClipboard(), the call throws, and nothing is copied.

The canvas is now converted to a PNG blob and written with the web Clipboard API (navigator.clipboard.write with a ClipboardItem), which is what the Electron notes recommend for renderers. The window is loaded from file:, so the API is available there.

Tested with Electron 45 in a window loaded from a local file with nodeIntegration on, like OpenComic: require('electron').clipboard is undefined, and after the new code the system clipboard holds an image/png item with the canvas image. I did not build the full app.

@ollm

ollm commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Thank you for fix!

I've tested it, and it works correctly.

I've merged it into the master branch.

@ollm
ollm merged commit f997cb5 into ollm:master Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Copying images to clipboard does not work on Windows 11

2 participants