LinuxCommandLibrary

img2sixel

Convert images to sixel graphics

TLDR

Display an image in the terminal

$ img2sixel [path/to/image]
copy

Resize the image to the specified width and height before displaying it
$ img2sixel [[-w|--width]] [number] [[-h|--height]] [number] [path/to/image]
copy

SYNOPSIS

img2sixel [options] [infile [outfile]]

PARAMETERS

-C, --colors=NUM
    Quantize to NUM colors (1-256*256*256, default 256)

-p, --paltype=TYPE
    Palette type: 0=auto,1=plainRGB,2=medianCut,3=web,4=xterm,5=rxvt,6=VT340,7=VT2410,8=RGBtxt (default 0)

-d, --div=NUM
    Dithering divisor (1-255, default 64)

-D, --dithertype=TYPE
    Dithering: 0=none,1=ordered,2=Floyd-Steinberg,3=Atkinson,4=quantErr,5=Meier (default 2)

-f, --forcemedia=TYPE
    Force input format (png,jpg,gif,bmp,tga,tif,wbmp,pcx,libsixel)

-q, --png-quality=NUM
    PNG crush level (0-9, default 0; higher=slower)

-s, --save-palette=PAL
    Save palette to PAL file

-w, --width=NUM
    Resize to NUM columns

-n, --nometa
    Omit meta DCS sequences

-h, --help
    Show help

-V, --version
    Show version

-v, --verbose
    Verbose output

DESCRIPTION

img2sixel is a command-line tool from the libsixel package that converts raster images (PNG, JPEG, GIF, BMP, TIFF, WebP, etc.) into SIXEL format, a compact bitmap graphics protocol for DEC VT terminals.

SIXEL enables displaying images directly in supporting terminals like mlterm, xterm with VT340 emulation, foot, kitty, and wezterm, ideal for terminal-based image viewing, scripting previews, or embedding graphics in text sessions.

The tool supports color palette quantization, dithering algorithms (Floyd-Steinberg, Atkinson, etc.), image resizing to terminal width, and palette export. It processes via stdin/stdout or files, optimizing for 64-color or palette-limited displays. Output streams raw SIXEL data, prefixed with DCS escape sequences for terminals.

CAVEATS

Requires terminal with SIXEL support; limited to ~256 colors effectively; large images resize poorly or fail in narrow terminals; depends on libsixel backend libraries for formats.

USAGE NOTE

Pipes to cat for display: img2sixel image.png | cat
Resize example: img2sixel -w 80 -C 64 image.jpg

HISTORY

Part of libsixel library, initiated 2014 by Takuto Asakura (saitoha) for modern SIXEL support in terminals; img2sixel added as demo/converter tool, evolved with palette/dithering enhancements in versions up to 1.10+.

SEE ALSO

sixel2png(1), sixel(5)

Copied to clipboard