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

[BUG] Can't paste image from clipboard

Open empz opened this issue 6 months ago • 12 comments

In some presentation I saw this was possible. Simply pasting an image from the clipboard directly into Claude Code. I'm not talking about pasting an existing file path, but the image itself on the clipboard. Most screenshots tools allows you to quickly capture an screenshot and put it on the clipboard without the need to save it to the file system. This is highly convenient when iterating on UI changes.

Environment

  • Platform (select one):
    • [x] Anthropic API
    • [ ] AWS Bedrock
    • [ ] Google Vertex AI
    • [ ] Other:
  • Claude CLI version: <1.0.3
  • Operating System: WSL2 (Ubuntu) on Windows 11
  • Terminal: Windows Terminal - Version: 1.22.11141.0 - Ubuntu bash

empz avatar May 27 '25 16:05 empz

If getting a keyboard shortcut to paste that works well across all platforms, OS, terminals and shells is tricky, maybe considering adding something like @clipboard to reference it?

That way we could tell Claude "check the screenshot on the @clipboard for a reference".

empz avatar May 28 '25 07:05 empz

I have that issue on iTerm and MacOS 15.5. Also if you drag and drop from Finder multiple images, it doesn't work. It copies path of those images instead of image.

Image

mirkancal avatar Jun 02 '25 03:06 mirkancal

Support directly paste image to CLI is very important for productivity!

1WorldCapture avatar Jun 08 '25 07:06 1WorldCapture

Have you tried Ctrl + V instead of Cmd + V?

andybergon avatar Jun 11 '25 03:06 andybergon

Have you tried Ctrl + V instead of Cmd + V?

I'm on Windows, there's no Cmd + V.

empz avatar Jun 11 '25 06:06 empz

Hi @rboyce-ant :) Do we have any news about this issue?

Support for pasting an image to the CLI is essential for web development Otherwise, for UI development is much more efficient to use Cursor or Windsurf

Do you need any additional info that may help?

Enviroment: VSCode Version: 1.96.2 Commit: 53b99ce608cba35127ae3a050c1738a959750860 Date: 2025-06-04T19:44:25.253Z Electron: 34.5.1 Chromium: 132.0.6834.210 Node.js: 20.19.0 V8: 13.2.152.41-electron.0 OS: Windows_NT x64 10.0.22631

CoderF3ff avatar Jun 11 '25 09:06 CoderF3ff

I’m on macOS Sequoia 15.1.1.

What I observe

Action Result
Take a screenshot while holding (⌃ ⇧ ⌘ 4) → Ctrl + V in Claude Code 📸 Image is pasted / attached correctly
Same screenshot → Cmd + V Image is not pasted. If there’s plain-text in the clipboard, that text is inserted; otherwise nothing happens.

So on macOS Ctrl + V pastes images only, whereas Cmd + V pastes text only and silently ignores any image/* MIME types.

Why this might happen

It looks like the editor intercepts Cmd + V (event.metaKey) and runs its own paste handler that only reads text/plain from clipboardData, dropping files and other MIME types.
Ctrl + V (event.ctrlKey) isn’t intercepted, so default(?) paste event bubbles up to the outer chat layer, which correctly attaches image files.

Image

satoooh avatar Jun 14 '25 05:06 satoooh

I’m on macOS Sequoia 15.1.1.

What I observe

Action Result Take a screenshot while holding (⌃ ⇧ ⌘ 4) → Ctrl + V in Claude Code 📸 Image is pasted / attached correctly Same screenshot → Cmd + V Image is not pasted. If there’s plain-text in the clipboard, that text is inserted; otherwise nothing happens. So on macOS Ctrl + V pastes images only, whereas Cmd + V pastes text only and silently ignores any image/* MIME types.

Why this might happen

It looks like the editor intercepts Cmd + V (event.metaKey) and runs its own paste handler that only reads text/plain from clipboardData, dropping files and other MIME types. Ctrl + V (event.ctrlKey) isn’t intercepted, so default(?) paste event bubbles up to the outer chat layer, which correctly attaches image files.

I've recently upgraded to a Mac and I'm getting the same behaviour in Sequoia. Except that I get an error message but it looks like it's able to access the image.

Image

empz avatar Jun 15 '25 07:06 empz

thanks for documenting this @satoooh good can confirm ctrl + v works on macOS for pasting screenshots even if that wasn't what I expected. I hope this behavior improves to respect whatever was last in my clipboard irrespective of image or text.

danielraffel avatar Jun 17 '25 03:06 danielraffel

this solution works for me on wsl2 and windows (technically platform agnostic, you have to modify the paths):

  1. Create a script to find latest screenshot at ~/.local/bin/lastshot:

    #!/bin/bash
    # ~/.local/bin/lastshot
    LATEST=$(ls -1t /mnt/c/Users/YourUsername/Pictures/Screenshots/*.png | head -n1)
    
    if [[ "$PWD" == /home/username/code/* ]]; then
        mkdir -p ./tmp
        ln -sf "$LATEST" ./tmp/latest_screenshot.png
        echo "./tmp/latest_screenshot.png"
    else
        echo "$LATEST"
    fi
    
  2. Make it executable: chmod +x ~/.local/bin/lastshot

  3. Add to CLAUDE.md:

    When I type "ss" in a message, automatically run lastshot and use the Read tool to display my latest screenshot.

  4. Usage: Type ss in any Claude messageand it automatically reads the last screenshot.

Why it works

  • Symlinks avoid permission issues
  • Works in any project directory
  • No need to save/copy file paths
  • Script handles Windows path translation

Takes 5 minutes to set up, saves hours of friction. The script is flexible. You can modify the screenshot path or add filters as needed.

Image

aphronio avatar Jun 18 '25 22:06 aphronio

this solution works for me on wsl2 and windows (technically platform agnostic, you have to modify the paths):

.................. Takes 5 minutes to set up, saves hours of friction. The script is flexible. You can modify the screenshot path or add filters as needed.

This works great! Easier than copy/paste as long as your screenshot utility is configured to save automatically. Thank you!

cd-rite avatar Jun 23 '25 14:06 cd-rite

sounds ctrl + v is working for macos sonoma 14.1, zsh and claude code

this is nice workaround but why can't we have coherrent behaviour? you know doing cmd + v everywhere and ctrl + v for claude is not 100% convenient :)

drswobodziczka avatar Jun 29 '25 22:06 drswobodziczka

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

In ubuntu I solved this particualr issue by installing xclip.

VamshiGoud avatar Jul 08 '25 11:07 VamshiGoud

On Windows, I found 1.0.45 works well with pasting image directly in GitBash but recent versions don't. So I stick with 1.0.45 for now, surely 1.0.45 has its own issues, and I have a workaround for it, see https://blog.shukebeta.com/2025/07/12/fixing-claude-code-in-git-bash/ for detail.

shukebeta avatar Jul 16 '25 01:07 shukebeta

on Pop!OS (based on Ubuntu Linux), I have another solution with Kitty terminal. see https://blog.shukebeta.com/2025/07/11/quick-fix-claude-code-image-paste-in-linux-terminal/ for detail.

shukebeta avatar Jul 16 '25 01:07 shukebeta

I just created a windows app to do this, It will copy the current screenshot as path, and you can ctrl+v to claude code: https://github.com/rizrmd/shotpath

rizrmd avatar Jul 31 '25 00:07 rizrmd

On Windows, I found 1.0.45 works well with pasting image directly in GitBash but recent versions don't. So I stick with 1.0.45 for now, surely 1.0.45 has its own issues, and I have a workaround for it, see https://blog.shukebeta.com/2025/07/12/fixing-claude-code-in-git-bash/ for detail.

Hi, thanks for sharing the workaround and the blog link! I'm currently on Windows 11, and I'm using PowerShell as the terminal when working with Claude Code. I'm wondering — does your method also work in PowerShell, or is it Git Bash–specific? Appreciate any insights!

printlndarling avatar Aug 01 '25 19:08 printlndarling

hi folks,

im on mac. i run my code on a remote server and connect to it using ssh. i also develop on this remote server since my code needs lot of cpus to compile. i use claude code cli to help development on this remote server.

i want to paste images so that claude code cli can understand the context. remember claude code cli is still running remotely on a remote linux server and im connecting using ssh.

what workaround does exist to paste image right into the claude code cli terminal in vscode/webstorm?

thank you in advance

lsntkadev avatar Aug 06 '25 19:08 lsntkadev

@lsntkadev I found the latest version 1.0.72 can work on gitbash (windows) and xfce4-terminal (linux x11) directly without any hacks. It should work on your mac I guess. Please try it with 1.0.72 and see if it works.

shukebeta avatar Aug 10 '25 23:08 shukebeta

@lsntkadev I found the latest version 1.0.72 can work on gitbash (windows) and xfce4-terminal (linux x11) directly without any hacks. It should work on your mac I guess. Please try it with 1.0.72 and see if it works.

Can confirm that it works on gitbash (windows) but I am still not able do paste screenshots into my WSL terminal (even when I use windows git bash in there)

10eputzen avatar Aug 13 '25 22:08 10eputzen

Can also confirm, pasting a image into claude code when running it within git bash for windows, is working. Natively opening cc from windows terminal does not work however.

Xanacas avatar Aug 19 '25 16:08 Xanacas

Works for me on arch linux with Xorg/i3, but does not work on another -- mostly the same setup -- Arch linux with KDE/Wayland.

Both use Kitty terminal (no ssh or containers).

glebtv avatar Aug 22 '25 19:08 glebtv

Works for me on arch linux with Xorg/i3, but does not work on another -- mostly the same setup -- Arch linux with KDE/Wayland.

Both use Kitty terminal (no ssh or containers).

Interesting. For me on Fedora with GNOME/Wayland (Ptyxis terminal) it works only if I copy the image from GNOME's Image Viewer (Loupe), otherwise pasting it does nothing.

If I copy the image directly from Firefox, for instance, it doesn't work (nothing to paste).

bgmulinari avatar Aug 26 '25 19:08 bgmulinari

I'm observing that pasting with Control + V on my mac pastes the last copied textin clipboard, even if the current clipboard entry is an image, across all apps. Anyone else run across this strange behavior? Makes pasting into claude code with this method unusable :/

MichaelHindley avatar Aug 28 '25 08:08 MichaelHindley

I'm observing that pasting with Control + V on my mac pastes the last copied textin clipboard, even if the current clipboard entry is an image, across all apps. Anyone else run across this strange behavior? Makes pasting into claude code with this method unusable :/

I have the exact same issue. It started happening this week. This brings a lot of suffering to my life. Please fix it 🙏

ignatovv avatar Aug 28 '25 13:08 ignatovv

You can paste images directly into Claude Code as long as your screenshot tool supports copying the screenshot as a file to the clipboard, rather than just as image data.

I'm using PixPin as my screenshot tool, which has this capability. When you take a screenshot with PixPin, it copies the image as a file object to the clipboard, allowing you to paste it directly into Claude Code without needing to save it to the filesystem first.

nasodaengineer avatar Aug 29 '25 06:08 nasodaengineer

According to Release 1.0.93 this issue should have been fixed with alt + v for Windows user - but I cannot confirm that using Windows + WSL + VSCode + various terminals (default, tmux, gitbash). [I am on release 1.0.96]

1.0.93 Windows: Add alt + v shortcut for pasting images from clipboard

Must be a good life at Anthropic when they can afford MacBooks for all employees.

Update It works indeed in the Windows terminal in VS Code (alt + v)

10eputzen avatar Aug 29 '25 06:08 10eputzen

Windows + Webstorm + SSH + Claude Code, here it still doesn't work pasting images unfortunately, anyways this is already a goated stack to code directly on servers with AI

lsntkadev avatar Sep 02 '25 14:09 lsntkadev

I recently had CTRL+V stopped working on Claude Code on WIndows using git-bash . It worked for weeks. Found out in another unrelated github issue that is now ALt+V. Created issue #7017 If it may help you (I did not tried with WSL)

deadeuzesse avatar Sep 02 '25 15:09 deadeuzesse