Show local image previews in the TUI
What variant of Codex are you using?
Codex CLI (TUI), tested in Kitty
What feature would you like to see?
When Codex references a local image in its final response, it would be useful to show a small preview directly below the path.
Right now, every referenced image has to be opened separately. This becomes inconvenient when working on UI, screenshots, generated images, or other visual tasks.
The original path should remain visible and clickable. The preview should preserve the image's aspect ratio and remain available after resizing the terminal, scrolling through the transcript, or reopening the session with codex resume.
Only images explicitly referenced in the final response should be shown. Images that Codex opened internally while working should not appear in the transcript.
On terminals without the required image support, or when a file is missing or cannot be decoded, Codex should simply leave the path as normal text.
Additional information
I built a proof of concept for this behavior:
https://github.com/Kpyruy/codex/commit/aaea18d724554c8ec108ba9c3a26a40a7fb6e8f8
It uses the Kitty graphics protocol and supports PNG, JPG/JPEG, WebP, and GIF files. Previews are reconstructed from the saved final response and the session working directory, so they also work after codex resume without storing image data in the conversation history.
The targeted image, streaming, and resume tests pass locally, as does the full codex-tui test suite.
I am opening an issue first as requested in the contribution guidelines. If this approach fits the project's direction, I would be happy to prepare a pull request if invited.
3 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Additional real-world reproduction on Linux/Kitty:
0.147.0Linux 7.0.0-29-generic x86_64TERM=xterm-kitty,COLORTERM=truecolor,KITTY_WINDOW_IDandKITTY_PIDpresent)Observed behavior:
``
text
``Viewed Image
└ path/to/image.png
No pixels are rendered.
kitten icat path/to/image.pngfrom its command executor fails with:``
text
``Failed to open controlling terminal with error: open /dev/tty: no such device or address
This appears to happen because the captured subprocess has no controlling TTY, even though Codex itself is running interactively in Kitty.
chafa --format symbols --colors 256generates ANSI output, but the Codex tool-output presentation escapes/sanitizes the control sequences instead of rendering them.--colors noneis usable only as a low-fidelity Unicode fallback.Expected behavior:
view_imagesucceeds in a terminal advertising Kitty graphics support, Codex TUI should render a bounded inline preview.This is a concrete instance of the feature requested here and also explains why invoking
kitten icatthrough the agent's command runner is not an adequate workaround.I have a simpler related use case: in the Codex CLI TUI, when an attached image is shown as
[Image #1], I would like that label to be actionable so I can reopen or preview the image later from the transcript.I do not need the original filesystem path to be exposed for this use case. The main need is to make the existing attachment reference usable as a way to view the image again.
Environment: