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

Feature Request: Terminal Graphics Protocol Support (Sixel, Kitty, iTerm2)

Open gwpl opened this issue 6 months ago • 9 comments

TL;DR / Abstract

Enable terminal graphics display in Claude Code by implementing support for Sixel, Kitty, and iTerm2 inline image protocols. This would allow users to view graphical output from commands (charts, diagrams, plots) directly in the terminal, enhancing data visualization and development workflows.

Problem Statement

Currently, Claude Code cannot display graphical output from terminal commands. Tools like lsix, viu, and various plotting libraries fail to render images, limiting visual feedback for:

  • Data visualization (matplotlib, plotly outputs)
  • Image processing results
  • System diagrams and flowcharts
  • Build process visualizations
  • Test coverage reports with visual elements

Proposed Solution

Implement support for three major terminal graphics protocols:

1. Sixel (Six Pixels)

  • Specification: DEC VT340/ANSI escape sequence based bitmap format
  • Format: ESC P q [data] ESC \
  • Features: 6-pixel high strips, RLE compression, palette-based colors (max 256)
  • Adoption: XTerm, mlterm, foot, WezTerm, Konsole, VS Code terminal
  • Pros: Widest compatibility, standardized since 1980s
  • Cons: Limited color palette, no alpha channel

2. Kitty Graphics Protocol

  • Format: ESC _ G [control data] ; [payload] ESC \
  • Features: Full RGBA support, GPU acceleration, multiple placement modes
  • Adoption: Kitty, WezTerm, Konsole
  • Pros: Best performance, full color support, advanced features
  • Cons: Limited terminal support

3. iTerm2 Inline Images

  • Format: ESC ] 1337 ; File = [args] : [base64 data] ^G
  • Features: Direct base64 encoding, supports animations, Retina displays
  • Adoption: iTerm2, WezTerm, mintty, Konsole
  • Pros: Simple implementation, works partially in tmux
  • Cons: macOS-centric origin

Implementation Approach

  1. Auto-detection: Check $TERM, $TERM_PROGRAM, and capability queries
  2. Fallback chain: Kitty → iTerm2 → Sixel → Unicode blocks (▄▀)
  3. Library integration: Consider using existing libraries like:

Testing Tools

# Sixel test
convert image.jpg -geometry 800x480 sixel:-

# iTerm2 test
printf "\e]1337;File=inline=1:"; base64 -w0 image.jpg; printf "\a\n"

# Tools to verify
lsix *.png                    # Sixel image viewer
viu --features=sixel *.png    # Multi-protocol viewer
img2sixel image.png          # Direct sixel conversion

Use Cases

  1. Development

    • Preview generated images/plots without leaving terminal
    • View test coverage heatmaps
    • Display architecture diagrams
  2. Data Science

    • Show matplotlib/seaborn outputs inline
    • Quick data exploration visualizations
    • Model performance graphs
  3. DevOps

    • System monitoring dashboards
    • Network topology diagrams
    • Container relationship visualizations

References

Success Criteria

  • [ ] Auto-detect terminal capabilities
  • [ ] Display images from common tools (lsix, viu, img2sixel)
  • [ ] Handle protocol-specific limitations gracefully
  • [ ] Provide clear error messages for unsupported terminals
  • [ ] Document supported terminals and protocols

This feature would significantly enhance Claude Code's capabilities for visual development workflows while maintaining backward compatibility through intelligent fallbacks.

gwpl avatar Jun 18 '25 17:06 gwpl

Important Clarification

This feature request primarily targets the shell command execution mode (commands run with \! prefix or via the Bash tool). Users frequently need to visualize outputs from their development workflows:

# Current state: These commands fail or show errors
\!lsix *.png
\!viu --features=sixel plot.png
\!python visualize_metrics.py  # outputs matplotlib chart
\!gnuplot performance.gp       # generates 3D plot
\!dot -Tpng graph.dot  < /dev/null |  viu -    # renders graphviz diagram
!neato -Tpng network.gv | lsix  # renders network graph
!fdp -Tpng -o /tmp/fdp.png large_graph.gv && viu /tmp/fdp.png  # force-directed graph
!echo "digraph G { A -> B -> C; }" | dot -Tpng | viu -  # inline graphviz

Immediate Benefits (Shell Commands)

  • View generated plots/charts without leaving Claude Code session
  • Inspect image processing results inline
  • Debug visual outputs during development
  • Review data visualizations from analysis scripts
  • Render architecture diagrams and flowcharts with graphviz

Future Potential: Visual Reasoning Capabilities

Beyond shell command support, terminal graphics could enable Claude to participate in visual analysis alongside users:

  1. Performance Analysis: Read benchmark charts together, identify bottlenecks visually
  2. Data Science Collaboration: Interpret 3D plots, statistical visualizations, ML model outputs
  3. Architecture Reviews: Analyze system diagrams, flowcharts, dependency graphs
  4. Debugging: Examine visual test outputs, coverage heatmaps, profiling flamegraphs

This would transform Claude Code from a text-only assistant to a visual collaborator, enabling richer human-AI interaction for data-heavy and visually-oriented development tasks.

The implementation should prioritize shell command support first, with the understanding that this infrastructure could later enable multimodal reasoning capabilities.

gwpl avatar Jun 18 '25 17:06 gwpl

I would really like to see this implemented! I think it would reinforce the validity of Claude Code in the terminal!

aaronsb avatar Aug 23 '25 03:08 aaronsb

I would love to have this! As more dev work moves to the CLI, features that eliminate context-switching are essential. Being able to instantly see visual outputs from Claude would be a huge win for keeping developers in a state of flow.

forayconsulting avatar Aug 23 '25 04:08 forayconsulting

+1

vfarcic avatar Dec 03 '25 19:12 vfarcic

+1

yuzutas0 avatar Dec 06 '25 13:12 yuzutas0

+1

plimanowka-lm avatar Dec 08 '25 08:12 plimanowka-lm

+1

mmc41 avatar Dec 13 '25 08:12 mmc41