imat-rs is a Rust + ratatui port of the sibling ../imat terminal image viewer.
It opens PNG, JPEG, and TIFF images directly in the terminal, including multipage TIFF stacks with reshape and axis navigation.
cargo run -- <path/to/image.png>
cargo run -- <path/to/image.tif>Build with the sam feature and pass ONNX models exported from keejkrej/sam-rs (image_encoder.onnx + mask_decoder.onnx, Meta SAM1-style, return_single_mask=true on the decoder).
cargo run --features sam -- \
--sam-encoder /path/to/image_encoder.onnx \
--sam-decoder /path/to/mask_decoder.onnx \
image.pngIn the viewer: s toggles SAM mode, hjkl moves the cursor (vim directions), Enter runs a foreground point prompt, Esc exits SAM mode. Page navigation with arrow keys is disabled while SAM mode is on. The mask is tinted green on the half-block image.
q quit
r reshape multipage TIFF pages
Esc return to flat page mode
Left/Right move within the current page axis or page list
Up/Down change the active reshape axis
With --features sam and both --sam-encoder / --sam-decoder: s SAM mode, hjkl cursor, Enter prompt, Esc exit SAM.
cargo run -- --shape 3,8,512,512 image.tif--shape expects a full row-major shape ending in H,W, and the product must equal the total RGBA pixel count.