XTSMGRAPHICS — Sixel / ReGIS / color-register capacity query + set (CSI ? Pi ; Pa ; Pv S)
Read / set the terminal's graphics limits — number of sixel color registers, sixel graphics area, ReGIS area. The standard knob for image-aware TUIs to size their bitmaps.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b[?<Pi>;<Pa>;<Pv>S\033[?1;1S\e[?1;1SESC [ ? Pi ; Pa ; Pv S1b 5b 3f ... 53Description
Xterm's graphics-capability primitive. The `?` prefix flips final-byte `S` from SU (scroll up) to XTSMGRAPHICS — note the parse ambiguity with SU (`\x1b[<Ps>S` without `?` is scroll-up). Three parameters: **`Pi` item** = `1` color registers, `2` sixel graphics area (rows×cols of pixels), `3` ReGIS graphics area. **`Pa` action** = `1` read current value, `2` reset to default, `3` set to `Pv`, `4` read maximum value. **`Pv` value** is only used when `Pa=3` (set). Reply is `\x1b[?<Pi>;<Ps>;<Pv>S` where `Ps` is a status code (`0` success, `1` error/no-graphics, `2` reset error, `3` set error, `4` out-of-range). Critical for sixel-emitting TUIs (like neovim's image.nvim, w3m-img, timg, chafa): before drawing they query `\x1b[?1;4S` (max color registers) and `\x1b[?2;1S` (current sixel area) to size their dither palette and tile dimensions correctly. xterm defaults are stingy (256 color registers, 1000×1000 pixel sixel area); kitty exposes huge values; alacritty/gnome-terminal/Windows Terminal return error or nothing (no sixel support). Always check the status code in the reply — `Ps=1` means the terminal said "no graphics for you" and you should fall back to half-block or ASCII art.
Spec citation: xterm-ctlseqs (XTSMGRAPHICS)
Parameters
| Pi | Item selector: `1` color registers, `2` sixel area, `3` ReGIS area. |
| Pa | Action: `1` read, `2` reset, `3` set (with Pv), `4` read max. |
| Pv | Value to set when Pa=3. Omitted otherwise. |
Examples
printf '\033[?1;4S' # query max color registers — reply: \x1b[?1;0;<max>Simport sys\nsys.stdout.write('\x1b[?2;1S') # current sixel pixel area\n# reply: \x1b[?2;0;<rows>;<cols>Sfmt.Print("\x1b[?1;3;1024S") // try to RAISE color registers to 1024 (kitty allows)process.stdout.write('\x1b[?3;1S') // query current ReGIS areaprintf("\x1b[?2;4S"); /* before sixel encode: ask max canvas size, scale image to fit */Terminal support
- xterm
- yes
- Linux console (fbcon)
- no
- macOS Terminal.app
- no
- iTerm2
- partial
- Windows Terminal
- no
- cmd.exe / ConPTY
- no
- kitty
- yes
- alacritty
- no
- WezTerm
- yes
- Ghostty
- partial
- GNOME Terminal
- no
- Konsole
- partial
- tmux
- no
- GNU screen
- no
| xterm | Linux console (fbcon) | macOS Terminal.app | iTerm2 | Windows Terminal | cmd.exe / ConPTY | kitty | alacritty | WezTerm | Ghostty | GNOME Terminal | Konsole | tmux | GNU screen |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| yes | no | no | partial | no | no | yes | no | yes | partial | no | partial | no | no |