Encode the image into a sixel control sequence and vice versa. If your terminal supports this format, then you can get a nice visualization of it.
This package, although itself complete, is probably not the most convinient way to use for normal users. Package authors that aims to support sixel for various image-like types (e.g., image, video, gif, graphic, plot, latex) are the potential targeted users of this package.
The core functionality of this package is supported by the C library libsixel.
This package exports two functions: sixel_encode
and sixel_decode
.
sixel_encode
converts the input array into sixel format sequence.sixel_decode
converts the input sixel format sequence into colorant array.One important thing about sixel is that not all terminals support sixel control sequence. The following is an incomplete list of terminals that support sixel.
Above these I only manually test iTerm2, mlterm and wezterm.
To run
xterm
with sixel support, use$ xterm -xrm "XTerm*decTerminalID: vt340" -xrm "XTerm*numColorRegisters: 256"
.
A demo in iTerm2:
It is the client terminal that renders the image. Hence if you're using any sixel-enabled terminal (e.g., iTerm2) and connect to other servers via ssh, you still get sixel supported. Sixel is nothing special but a string sequence.
Unfortunately, there are some famous widely used advanced terminal/emulator that do not support sixel (yet):
For more information, you can also read the Terminal requirements section in the libsixel repo.
Sixel.jl provides a function to test if your terminal supports it: Sixel.is_sixel_supported()
. If
your terminal actually supports sixel and it returns false
, please open an issue for it.