Display images inline in the terminal using kitty graphics protocol, sixel, or w3m. Auto-detects the best protocol for your terminal. Feature clone of termpix.
Used by pointer for file preview images.
[dependencies]
glow = { version = "0.1", path = "../glow" }use glow::Display;
let mut display = Display::new(); // Auto-detects protocol
if display.supported() {
display.show("photo.png", 10, 5, 60, 30); // x, y, max_w, max_h
// ... later ...
display.clear(10, 5, 60, 30, 80, 24); // Clear region
}| Protocol | Terminals | Detection |
|---|---|---|
| Kitty | kitty, WezTerm | TERM=xterm-kitty, KITTY_WINDOW_ID, TERM_PROGRAM=WezTerm |
| Sixel | xterm, mlterm, foot | TERM starts with xterm/mlterm/foot |
| W3m | Any X11 terminal | /usr/lib/w3m/w3mimgdisplay exists |
pub struct Display { ... }
impl Display {
pub fn new() -> Self; // Auto-detect protocol
pub fn supported(&self) -> bool; // Check if display works
pub fn protocol(&self) -> Option<Protocol>; // Which protocol
pub fn show(&mut self,
image_path: &str, // Path to image file
x: u16, y: u16, // Character position
max_width: u16, max_height: u16 // Max size in chars
) -> bool; // Success
pub fn clear(&mut self,
x: u16, y: u16, // Region position
width: u16, height: u16, // Region size
term_width: u16, term_height: u16 // Terminal size
);
}- Kitty: Scales image with ImageMagick
convert, base64 encodes, transmits in 4KB chunks via escape sequences. Caches processed images by path+dimensions+mtime. - Sixel: Uses
convertto generate sixel output directly. - W3m: Calculates pixel coordinates from cell size, communicates with
w3mimgdisplay.
- ImageMagick (
convert) - required for kitty and sixel protocols - w3mimgdisplay - required for w3m protocol only
- xdotool + xwininfo - required for w3m protocol only
See the Fe₂O₃ suite overview and the landing page for the full list of projects.
| Tool | Clones | Type |
|---|---|---|
| rush | rsh | Shell |
| crust | rcurses | TUI library |
| glow | termpix | Image display |
| plot | termchart | Charts |
| pointer | RTFM | File manager |
Unlicense - public domain.
Created by Geir Isene (https://isene.org) with extensive pair-programming with Claude Code.