icy_sixel
A high-performance, 100% pure Rust implementation of a SIXEL encoder and decoder.
I wanted a pure Rust implementation to simplify deployment of my cross-platform applications. In version 0.4.0, I rewrote the encoder using quantette, a high-quality color quantization library licensed under MIT/Apache-2.0. It uses Wu's algorithm with Floyd-Steinberg dithering for excellent results.
The decoder is a clean-room implementation based on the SIXEL specification, with SIMD optimizations for maximum performance.
Features
- SIXEL Encoder: High-quality color quantization with quantette (Wu's algorithm + Floyd-Steinberg dithering)
- SIXEL Decoder: Clean-room implementation with RGBA output and SSE2 SIMD acceleration
- Transparency Support: Full alpha channel handling in both encoder and decoder
- Pure Rust: No C dependencies, easy to build and deploy
- Cross-platform: Works on Linux, macOS, and Windows
Installation
Add this to your Cargo.toml:
[]
= "0.4"
Usage
Encoding an Image to SIXEL
use ;
// RGBA image data (4 bytes per pixel)
let rgba = vec!;
let options = default;
let sixel = sixel_encode?;
print!;
Encoding with Custom Options
use ;
let options = EncodeOptions ;
let sixel = sixel_encode?;
Decoding SIXEL to Image Data
use sixel_decode;
let sixel_data = b"\x1bPq#0;2;100;0;0#0~-\x1b\\";
let image = sixel_decode?;
// image.rgba contains RGBA pixel data (4 bytes per pixel)
// image.width and image.height contain dimensions
CLI Tool
The crate includes a command-line tool for encoding and decoding:
# Install the CLI
# Encode a PNG to SIXEL
# Encode with custom settings
# Decode SIXEL to PNG
# Display image in terminal (requires SIXEL-capable terminal)
Architecture
Encoder
The encoder uses quantette for high-quality color quantization with Wu's algorithm and Floyd-Steinberg dithering. This produces excellent results, especially for images with gradients or complex color distributions.
Decoder
The decoder is a clean-room implementation derived from the SIXEL specification:
- Returns RGBA buffers (4 bytes per pixel) for easy integration with graphics libraries
- SIMD-accelerated horizontal span filling on x86/x86_64 (SSE2)
- Optimized with color caching and loop unrolling
- Comprehensive bounds checking prevents buffer overflows
Showcase
Original image for reference:

Quality comparison using a 596×936 pixel photograph (original: 879 KB PNG):
| Settings | SIXEL Size | Decoded Result |
|---|---|---|
| 256 colors (default) | 1,066 KB | ![]() |
| 16 colors | 439 KB | ![]() |
| 2 colors | 104 KB | ![]() |
License
Licensed under the Apache License, Version 2.0 — see LICENSE for details.


