copy-as-image

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Copy as Image

复制为图片

Capture the last meaningful Claude response as a styled terminal screenshot image and copy it to the clipboard.
将Claude的最后一条有意义的回复捕获为风格化的终端截图并复制到剪贴板。

Selecting the right response

选择正确的回复

Look back through the conversation and find your last substantial assistant response. Skip over any of the following:
  • One-line or very short replies (e.g. "Done.", "OK", "Sure")
  • Slash command outputs (messages that start with
    /
    )
  • Tool invocation confirmations
  • This current skill invocation itself
Pick the most recent assistant message that has meaningful multi-line content (explanations, code, analysis, etc.).
回顾对话记录,找到你的最后一条有实质内容的助手回复。跳过以下类型的内容:
  • 单行或极短的回复(例如“完成。”、“好的”、“没问题”)
  • 斜杠命令输出(以
    /
    开头的消息)
  • 工具调用确认信息
  • 当前的技能调用消息本身
选择最新的包含有意义的多行内容(解释、代码、分析等)的助手消息。

Steps

步骤

Do everything in a single Bash call. Use a timestamp-based temp file name (do NOT use mktemp with XXXXXX templates). Write the response, run the script, and clean up:
bash
TMPFILE="/tmp/claude-response-$(date +%s%N).md"
SKILL_DIR="${CLAUDE_SKILL_DIR}"

cat > "$TMPFILE" << 'CLAUDE_EOF'
<paste the full text of the chosen response here>
CLAUDE_EOF

cd "$SKILL_DIR/scripts" && \
  (test -d ../node_modules || npm install --prefix .. --omit=dev 2>/dev/null) && \
  node copy-as-image.mjs "$TMPFILE"

rm -f "$TMPFILE"
After the command finishes, tell the user:
  • "Image copied to clipboard! Paste anywhere with Cmd+V (macOS) or Ctrl+V (Linux)."
  • Show the saved PNG file path from the script output.
单个Bash调用中完成所有操作。使用基于时间戳的临时文件名(请勿使用带有XXXXXX模板的mktemp)。写入回复内容、运行脚本并清理:
bash
TMPFILE="/tmp/claude-response-$(date +%s%N).md"
SKILL_DIR="${CLAUDE_SKILL_DIR}"

cat > "$TMPFILE" << 'CLAUDE_EOF'
<paste the full text of the chosen response here>
CLAUDE_EOF

cd "$SKILL_DIR/scripts" && \
  (test -d ../node_modules || npm install --prefix .. --omit=dev 2>/dev/null) && \
  node copy-as-image.mjs "$TMPFILE"

rm -f "$TMPFILE"
命令完成后,告知用户:
  • "图片已复制到剪贴板!在macOS上使用Cmd+V粘贴,在Linux上使用Ctrl+V粘贴。"
  • 显示脚本输出中的已保存PNG文件路径。

Important Notes

重要说明

  • Only requires Node.js (no bun/deno needed)
  • Works on macOS (uses
    osascript
    ) and Linux (requires
    xclip
    or
    xsel
    )
  • The image uses a dark terminal theme with One Dark syntax highlighting
  • Output is rendered at 2x resolution for Retina/HiDPI displays
  • 仅需依赖Node.js(无需bun/deno)
  • 支持macOS(使用
    osascript
    )和Linux(需要
    xclip
    xsel
  • 图片采用深色终端主题,搭配One Dark语法高亮
  • 输出以2倍分辨率渲染,适配Retina/HiDPI显示屏