claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Unable to paste images into Claude Code TUI interface

Open lockmeister opened this issue 8 months ago • 21 comments

Environment

  • Claude CLI version: 0.2.74
  • Operating System: Ubuntu 22.04
  • Terminal: gnome-terminal xterm-256color

Bug Description

Steps to Reproduce

  1. run claude code
  2. attempt to paste images via ctrl-v
  3. nothing happens

Expected Behavior

https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#work-with-images Docs seem to imply that ctrl-v should allow pasting of images

lockmeister avatar Apr 21 '25 04:04 lockmeister

I can drag and drop images in, which inserts the image file path in single quotes. But Claude code does not seem to actually see the image, when I ask questions about the image via prompts, the answers are off.

lockmeister avatar Apr 21 '25 11:04 lockmeister

using kitty, feel like it could be a terminal specific issue. Was not able to paste the image too but dragging the image from a UI file explorer works. maybe if will be better if we can have a command to retrieve from system clipboard?

Stewart86 avatar Apr 23 '25 06:04 Stewart86

We just shipped some fixes and improvements to this. Dragging should work now in a broader set of cases. cmd-v on mac should work for pasting image files ctrl-v on mac should work for pasting images (like screenshots) which aren't files.

Will do some testing on Ubuntu!

igorkofman avatar Apr 23 '25 16:04 igorkofman

I have just tested with Arch Linux running wayland on Kitty terminal. can confirm that it is still not working. Clipboard on Linux can be challenging.

Stewart86 avatar Apr 24 '25 03:04 Stewart86

This also happens on the Warp terminal on macOS. Pasted images result in a 400 error invalid formatting. When I use the same claude installation on my stock mac terminal, it works fine.

jly-x avatar Apr 28 '25 19:04 jly-x

Still not working on Arch Linux (kitty Terminal)

SamDc73 avatar May 22 '25 04:05 SamDc73

Not working for me. I'm on Mac M1 + Iterm + zsh + Claude Code 1.0.2 Drag and drop works fine (pasts the path)

maksimu avatar May 23 '25 16:05 maksimu

Im on M4 Mac with the native OS terminal. Doesn't work with cmd+v specifically for those images and screenshots you capture and have them on your clipboard. I use the Maccy clipboard to hold my clipboard histories. Any ETA on the fix ?

kkrishnan90 avatar May 24 '25 11:05 kkrishnan90

I found a work an around on my Linux machine using Kitty terminal on Wayland !

  1. first install Kitty terminal and wl-clipboard.
  2. first create this script clip2path and place in ~/.local/bin
#!/usr/bin/env bash
set -e

types=$(wl-paste --list-types)

if grep -q '^text/' <<<"$types"; then
    wl-paste --no-newline | kitty @ send-text --stdin             
elif grep -q '^image/' <<<"$types"; then
    ext=$(grep -m1 '^image/' <<<"$types" | cut -d/ -f2 | cut -d';' -f1)
    file="/tmp/clip_$(date +%s).${ext}"
    wl-paste > "$file"
    printf '%q' "$file" | kitty @ send-text --stdin             
else
    wl-paste --no-newline | kitty @ send-text --stdin
fi

then run chmod a+x ~/.local/bin/clip2path

  1. inside in kitty config file ~/.config/kitty/kitty.conf add this :
allow_remote_control yes

map ctrl+v launch --type=background --allow-remote-control --keep-focus ~/.local/bin/clip2path

And restart the terminal !


Expected behavior :

When you hit Ctrl+v in the terminal it will paste text, if it's a copied file it pastes the path in the terminal, if it's a screenshot it will save it to a temp path and paste that path !

On Xorg you should be able to do the same with a bit of modifications. Tested on Arch Linux KDE Wayland !

SamDc73 avatar May 24 '25 19:05 SamDc73

I found a work an around on my Linux machine using Kitty terminal on Wayland !

1. first install Kitty terminal and wl-clipboard.

2. first create this script `clip2path ` and place in `~/.local/bin`
#!/usr/bin/env bash
set -e

types=$(wl-paste --list-types)

if grep -q '^text/' <<<"$types"; then
    wl-paste --no-newline | kitty @ send-text --stdin             
elif grep -q '^image/' <<<"$types"; then
    ext=$(grep -m1 '^image/' <<<"$types" | cut -d/ -f2 | cut -d';' -f1)
    file="/tmp/clip_$(date +%s).${ext}"
    wl-paste > "$file"
    printf '%q' "$file" | kitty @ send-text --stdin             
else
    wl-paste --no-newline | kitty @ send-text --stdin
fi

then run chmod a+x ~/.local/bin/clip2path

3. inside in kitty config file `~/.config/kitty/kitty.conf` add this :
allow_remote_control yes

map ctrl+v launch --type=background --allow-remote-control --keep-focus ~/.local/bin/clip2path

And restart the terminal !

Expected behavior :

When you hit Ctrl+v in the terminal it will paste text, if it's a copied file it pastes the path in the terminal, if it's a screenshot it will save it to a temp path and paste that path !

On Xorg you should be able to do the same with a bit of modifications. Tested on Arch Linux KDE Wayland !

You are a genius! This workaround works! running kitty on Arch

Stewart86 avatar May 25 '25 08:05 Stewart86

For macs, I made an app, which introduces a hotkey Cmd + Option + 4 which save the screenshot temporarily to disk (deleted within ~1h) and copies the file path to your clipboard/Users/my-user-name/Documents/Claude Shots/2025-05-31T11.07.35.png and so can directly paste to terminal. It's the workaround I found for now.

Image

Noitidart avatar May 31 '25 18:05 Noitidart

@Noitidart feel free to share the solution as that sounds like a good workaround

ashrodan avatar Jun 04 '25 00:06 ashrodan

Well I figured out. It's buried deep in the documentation or I don't remember exactly where I read (may be in the best practice guide). You copy from the clipboard (grab the screenshot cmd+shift+4) and use ctrl+v (NOT cmd+v) on Mac and it works now. I use Maccy as my clipboard manager

kkrishnan90 avatar Jun 04 '25 15:06 kkrishnan90

Oh wow tank you @kkrishnan90 that worked! I use native macos cmd+shift+ctrl+4 and no special clipboard manager, just macos. Ctrl+V worked.

CC: @ashrodan

Noitidart avatar Jun 04 '25 15:06 Noitidart

What about windows + wls?

ziv770 avatar Jun 06 '25 09:06 ziv770

windows + WSL is indeed an issue, cntrl+v doesnt work in my bash terminal on wsl2

oxillix avatar Jun 10 '25 19:06 oxillix

Yupp agreed windows + WSL is an issue for screenshot at this point

shobhi1310 avatar Jun 16 '25 07:06 shobhi1310

Linux Kubuntu 25.04 on Konsole.

Clipboard pasting not working either. It works if I copy the location of a file from a directory (through Dolphin) and paste into Claude Code TUI.

alessionobile avatar Jun 18 '25 03:06 alessionobile

when using ssh and vscode, it not works.

isCopyman avatar Jun 22 '25 07:06 isCopyman

https://docs.anthropic.com/en/docs/claude-code/common-workflows#work-with-images:~:text=Copy%20an%20image%20and%20paste%20it%20into%20the%20CLI%20with%20ctrl%2Bv%20(Do%20not%20use%20cmd%2Bv) Pasting images doesn't work in a VSCode terminal on 1.0.34 (Claude Code)

znorris avatar Jun 25 '25 15:06 znorris

I can't paste images when I am using Hyprland/Hyprshot that copies it to the clipboard. But on KDE, I am able to use specatcle copy to clipboard and paste into VSCode.

ZerkerEOD avatar Jun 26 '25 14:06 ZerkerEOD

Same problem vscode hyprland wayland

neondeex avatar Jul 02 '25 16:07 neondeex

For Linux, try this https://github.com/thecodecentral/gshot-copy. It requires X11. I haven't tested it in Wayland. Maybe someone can create a PR for Wayland.

thecodecentral avatar Jul 03 '25 03:07 thecodecentral

I haven't figured out how to get ctrl+C / ctrl+V to work, but I did finally figure out a more reasonable way of getting screenshots to Claude Code using Windows Terminal and WSL.

In Windows Terminal settings, go to the profile where you use Claude Code (Ubuntu for me), and under Additional Settings click on "Advanced" then set "Path Translation" to "WSL".

With that done, I can now drag and drop an image from Windows Explorer into Claude code.

Image

rsteenwyk avatar Jul 03 '25 13:07 rsteenwyk

cntr+v not working in claude code. I am using windows and vs code and tunneling ubuntu 1.0.43 (Claude Code) Ubuntu 24.04.2 LTS VS code Version: 1.101.2 (user setup) Commit: 2901c5ac6db8a986a5666c3af51ff804d05af0d4 Date: 2025-06-24T20:27:15.391Z Electron: 35.5.1 ElectronBuildId: 11727614 Chromium: 134.0.6998.205 Node.js: 22.15.1 V8: 13.4.114.21-electron.0 OS: Windows_NT x64 10.0.19045

nishantsah08 avatar Jul 05 '25 03:07 nishantsah08

for X11 users who use kitty terminal, this tutorial can help you out. https://blog.shukebeta.com/2025/07/11/quick-fix-claude-code-image-paste-in-linux-terminal/

Many thanks to @SamDc73 as it is basically his idea!

shukebeta avatar Jul 11 '25 09:07 shukebeta

for X11 users who use kitty terminal, this tutorial can help you out. https://blog.shukebeta.com/2025/07/11/quick-fix-claude-code-image-paste-in-linux-terminal/

Many thanks to @Stewart86 as it is basically his idea!

Not mine. You tagged / credited the wrong person. 🫣

Stewart86 avatar Jul 11 '25 09:07 Stewart86

copy image from clipboard works previously on mac, but break at least in version 1.0.63

jiangying000 avatar Jul 30 '25 11:07 jiangying000

tmux + foot (or any other teminal) soluton:

shotout to @Stewart86

bind -n C-v run-shell -b "clip2path | tmux load-buffer -; tmux paste-buffer"

al3rez avatar Aug 01 '25 22:08 al3rez

I'm running into the same issue. On windows, I cannot use the crtl+v to paste images. It does however work on my mac.

AktivDevOps avatar Aug 04 '25 20:08 AktivDevOps