image-preview

Reviewed at commit 57aa285 New version, not yet reviewed

Hover a pasted [Image #N] to see the picture: above the prompt while you write, and on the prompts you sent.

What we checked

Shows a preview of a pasted [Image #N] when you hover it, above the prompt and on sent prompts, drawn by the terminal, in coloured cells, or (by default, outside SSH) in a small window by the pointer. It reads the pasted image from Claude Code's temp folder and runs local image tools and a short helper script to shrink and show it, now also under WSL via Windows' PowerShell and Explorer. It makes no network calls.

Review details

Static review of the source at the pinned commit; not run. Delta review of the changes since c2ee6a4; the rest carries over from the review at that commit. Hooks: session.start, session.end (new: cancels the poll and closes the window), prompt.edit, prompt.submit, ui.message and ui.render (transcript rows and AbovePrompt). It reads the prompt box text every 500 ms only to find [Image #N] placeholders, looks for images/N.ext under Claude Code's per-session temp folder (CLAUDE_CODE_TMPDIR or the system temp, found with $.fs.list/exists; file names must match digits.letters), and writes converted copies (BMP/PNG) to an image-preview folder next to them. It runs local programs without a shell: uname, id -u, mkdir -p, sips, magick or convert (ImageMagick) on macOS/Linux, PowerShell with System.Drawing on Windows, osascript (JXA) on macOS, python3 with tkinter on Linux/X11, and open, explorer or xdg-open on the image when you click a placeholder. What changed: support for WSL (detected from WSL_DISTRO_NAME on Linux). There it runs the same fixed PowerShell scripts as powershell.exe, passing the image path and size through environment variables listed in WSLENV (paths translated with the /p flag), uses wslpath -w and explorer.exe to open the image, and shows the preview window as a Windows window. The rest is performance work (cached transcript order, reusable scratch buffers in the cell renderer in pixels.ts, a failed-image set, the mkdir done once per session, skipped work when no card is open) and a poll timer cancelled at session end. The helper scripts are still fixed strings in hooks/window.ts with no network or file-write code beyond the converted copy. On Windows the popup script compiles a small fixed C# form class once into %TEMP%\image-preview-popup-1.dll and loads it on later runs (a file already at that path would be loaded as is). PowerShell is started with -ExecutionPolicy Bypass for its own embedded scripts only. The window setting (default on) can be switched off in the plugin options; the window stays at most 120 s and takes no focus. Reads the environment (TERM_PROGRAM, TERM, KITTY_WINDOW_ID, CLAUDE_CODE_FORCE_TERMINAL_IMAGES, SSH_*, DISPLAY, WSL_DISTRO_NAME, WSLENV, TEMP, TMP, SystemRoot, OS, CLAUDE_CODE_TMPDIR) only to choose how to draw. No npm dependencies. The whole diff was read; ImageMagick, sips and System.Drawing parse the pasted image themselves and were not reviewed.

What it uses
  • Reads your prompts: yes
  • Sees tool calls: no
  • Blocks or changes tool calls: no
  • Reads or writes files: yes
  • Runs programs on your machine: yes
  • Calls the model (uses tokens): no
  • Sends data over the network: no
  • Stores data: yes
  • Shows something on screen: yes
Hooked events
Made this mod? Add a badge to your README

modsforClaude badge for image-preview

Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.

[![Listed on modsforClaude](https://modsforclaude.com/badge/image-preview.svg)](https://modsforclaude.com/mods/image-preview/)

← All mods