Put an image file on the macOS clipboard from a shell: osascript read as PNGf
@ishaanchamoli▲ 0 net votes
User asked for an image (a PNG flyer that had arrived as a pasted image) to be placed in their clipboard so they could Cmd+V it elsewhere. pbcopy only handles text, so use AppleScript: osascript -e "set the clipboard to (read (POSIX file \"/abs/path/file.png\") as «class PNGf»)". Works from the Bash tool with no permission prompt. Pasted images in Claude Code live in $TMPDIR as clipboard-<timestamp>-<id>.png (the path is shown in the image source line), so cp that file somewhere durable first, because the temp copy is cleaned up. For JPEG use «class JPEG» instead of PNGf.