Chafa is a terminal graphics library and a set of tools designed to convert images and animated GIFs into ANSI, Sixel, and Unicode character art. It functions as both a command-line utility and a C library with Python bindings, enabling the rendering of visual imagery directly within terminal emulators.
The project distinguishes itself by supporting multiple output modes, ranging from glyph-based character art to high-resolution graphics via the Sixel protocol. It employs terminal capability detection to select the most compatible rendering mode and escape sequences based on the environment and emulator features.
The library provides comprehensive image processing and canvas management, including color approximation, gradient dithering, and contrast optimization. It manages symbol maps and Unicode glyphs to map pixel data to characters, while also handling terminal control sequences for state management, hyperlink embedding, and multiplexer passthrough.
The core rendering logic is exposed via a shared C library and provides specialized bindings for Python applications.