explaingit

hpjansson/chafa

4,793CAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A command-line tool that converts images and animated GIFs into colored text art you can display right inside a terminal window, from rough block characters to detailed Unicode art depending on your terminal's capabilities.

Mindmap

mindmap
  root((chafa))
    What it does
      Convert images to terminal art
      Support animated GIFs
      Adapt to terminal capability
    Inputs
      JPEG PNG GIF
      SVG WebP TIFF
      Any image file
    Outputs
      Block character art
      Unicode color art
      Animated terminal output
    Integration
      C library with public API
      Python bindings
      WebAssembly port
    Tech Stack
      C core library
      LGPL v3 license
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Preview images and animated GIFs directly in a terminal without opening a GUI image viewer.

USE CASE 2

Add image-to-text art conversion to a web app using the WebAssembly port that runs in the browser or Node.js.

USE CASE 3

Integrate the C library into a custom application to render images as terminal art programmatically via the public API.

Tech stack

CPythonJavaScriptWebAssemblyNode.jsGCC

Getting it running

Difficulty · easy Time to first run · 5min
Free to use and distribute, the Lesser GPL allows you to use the library in projects with other licenses, but modifications to Chafa itself must remain open source.

In plain English

Chafa is a command-line tool that converts images into text-based art you can display inside a terminal window. You point it at an image file, including animated GIFs, and it outputs a version made of colored text characters that approximates what the image looks like. The result can range from rough block-character representations suitable for old-style terminals to detailed Unicode art on modern terminal emulators, depending on what the terminal supports. The project is built around a C library with a public API, meaning other programs can use the same conversion engine without going through the command-line tool. Python and JavaScript bindings are available through separate community-maintained projects, including a WebAssembly port that works in web browsers and Node.js. Chafa is packaged in most major Linux distributions, so for most users installation is a single package manager command. Building from source requires GCC and a handful of standard development libraries. Optional dependencies like libjpeg, librsvg, libtiff, and libwebp extend the range of input formats the tool can read. The project is licensed under the Lesser GPL, version 3 or later, which allows the library to be used in projects with other licenses under certain conditions. The README is brief and points to the project website for a gallery of example outputs and more detailed documentation. The C API reference is also hosted online for developers who want to integrate the library into their own applications.

Copy-paste prompts

Prompt 1
How do I install chafa and convert a JPEG image to colored terminal art with a single command?
Prompt 2
Show me how to display an animated GIF in the terminal using chafa and control the character resolution.
Prompt 3
How do I use the chafa WebAssembly port in a web browser to convert a user-uploaded image to terminal art?
Prompt 4
How do I call the chafa C library from my own C program to convert images to text art without using the CLI?
Prompt 5
What optional dependencies do I need to install to give chafa support for WebP and SVG input files?
Open on GitHub → Explain another repo

← hpjansson on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.