carbonian.org / manual pages
CARBONIAN-SIXEL(1) Carbonian Manual CARBONIAN-SIXEL(1)

carbonian-sixel - encode RGB pixels or PPM files as sixel pictures, keeping the palette's flat colours exact

carbonian-sixel --rgb WIDTHxHEIGHT [--colors N] [--pin-share F] < pixels
carbonian-sixel [--colors N] [--pin-share F] FILE.ppm...

carbonian-sixel turns a picture into a sixel picture for the terminal (foot, tmux) on standard output. The colours that cover a share of the picture of at least F are kept exactly, at most half the palette's entries, the most used first, so that a plot's background and the palette's colours stay the terminal's own; all others are reduced by median cut into the remaining entries, and every pixel takes its nearest entry.

It is the sixel core of the notebook's carbonian_sixel.py in Rust, with the same output byte for byte. carbonian_sixel.to_sixel() uses it when it is on PATH (or is /usr/lib/carbonian/carbonian-sixel) and falls back to its Python otherwise; the callers are the notebooks' figures (nbreport.py), the matplotlib backend and carbonian-view(1) for still pictures.

With --rgb it reads WIDTH × HEIGHT × 3 bytes of RGB from standard input (the picture already decoded and fitted to the pane) and writes its sixel as it is. Otherwise it reads each binary PPM file (P6, maxval 255) and prints its sixel and a newline.

Read raw RGB pixels of this size from standard input.
The number of colours, 2 to 256 (default CARBONIAN_MPLSIXEL_COLORS, else 256).
The share of the pixels a colour must cover to be kept exactly (default 0.002).
The usage, and exit.
Print the name and version, and exit.

0 on success; 2 on an error (an unknown option, a bad size, short input, a file that is not a binary PPM).

The default number of colours.
python makes carbonian_sixel.py keep its Python encoder instead of this one.

carbonian-sixel --colors 16 plot.ppm

carbonian-notebook(1), carbonian-view(1), carbonian-nb(1), carbonian-palette(1)

2026-11-03 Carbonian