Skip to main content

Overview

Sixel is a bitmap graphics format that allows terminals to display images inline. tmux includes comprehensive sixel support when compiled with the appropriate libraries, enabling image display in panes.
Sixel support requires:
  • tmux compiled with sixel support (typically requires libsixel)
  • Terminal that supports sixel graphics
  • Enabled via terminal-features

Sixel Protocol

Image Format

From image-sixel.c:26-54, sixel images are represented internally as:

Sixel Line Structure

From image-sixel.c:29-32:
Each sixel line contains 6 pixels vertically, encoded as a single character.

Terminal Feature

From tty-features.c:350-358, enable sixel support:

Configuration

~/.tmux.conf

Sixel Parsing

Image Sequence Format

From image-sixel.c:299-354, sixel sequences start with:
Where:
  • \033P - DCS (Device Control String) introducer
  • <parameters> - Optional parameters
  • q - Sixel command
  • <sixel-data> - Encoded image data
  • \033\\ - ST (String Terminator)

Sixel Parser

From image-sixel.c:299-362, the parser handles:

Sixel Commands

From image-sixel.c:143-193, define image dimensions:
Where:
  • Pan: Pixel aspect ratio numerator
  • Pad: Pixel aspect ratio denominator
  • Ph: Horizontal size in pixels
  • Pv: Vertical size in pixels
Example:
Defines an 800x600 image with 1:1 aspect ratio.

Image Size Limits

From image-sixel.c:26-27:
These limits prevent excessive memory usage:
  • Maximum width: 10,000 pixels
  • Maximum height: 10,000 pixels
From image-sixel.c:70-78 and 82-92:

Image Scaling

From image-sixel.c:416-484, images can be scaled to fit terminal cells:

Cell Size Calculation

From image-sixel.c:403-414:

Sixel Output

From image-sixel.c:571-656, generating sixel sequences:

Compression

From image-sixel.c:520-569, sixel data is run-length encoded:
Short runs (1-3 pixels) are output directly. Longer runs use the repeat syntax.

Displaying Images

Screen Conversion

From image-sixel.c:658-690, convert sixel to tmux screen:
This creates a placeholder screen showing the image dimensions.

Debugging Sixel

From image-sixel.c:377-401, log sixel image details:
Enable debug logging:

Supported Terminals

Terminals with sixel support:

xterm

Built-in sixel support (configure with --enable-sixel-graphics).

mlterm

Native sixel support, optimized for performance.

foot

Modern Wayland terminal with sixel support.

WezTerm

Cross-platform terminal with sixel support.

kitty

Supports kitty graphics protocol (not sixel) but has sixel compatibility mode.

iTerm2

Supports inline images protocol (not sixel directly).

Image Tools

Convert images to sixel:

Image viewers:

  • lsix: Thumbnail browser using sixel
  • viu: Image viewer for terminals
  • chafa: Versatile image-to-text converter with sixel support

Limitations

Sixel support has several limitations:
  1. Color depth: Limited to 256 colors typically (though some terminals support more)
  2. Memory usage: Large images consume significant memory
  3. Performance: Rendering can be slow for complex images
  4. Terminal compatibility: Not all terminals support sixel
  5. tmux limitations: Images may not persist across redraws in all situations
From image-sixel.c:210-215:

Best Practices

Use appropriate image sizes - don’t exceed terminal dimensions
Limit color palette to 256 colors for best compatibility
Test sixel support before deploying image-heavy applications
Provide text fallbacks for terminals without sixel support

Resources