Skip to content(if available)orjump to list(if available)

Chafa: Terminal Graphics for the 21st Century

jazzyjackson

I learned about Chafa when I found a video editor that runs in the command line with keyboard control - vic - it just lets you insert split markers and when you exit the video is sliced up into the portions. I really like the low-fi nature of scrobbling through the video, it has low brain overhead.

https://github.com/wong-justin/vic

jbaber

Wow. Thanks for this recommendation! I have multiple times half-baked something like this using ffmpeg to dump out thumbnails and make cuts.

joouha

I use chafa extensively, and it really is the best tool for terminal graphics in my opinion.

I use it as a fallback option for terminals without proper terminal graphics support in my TUI Jupyter client, euporie.

There are Python bindings available: https://github.com/GuardKenzie/chafa.py

Abishek_Muthian

Have you tried Charmbracelet's bubble tea - https://github.com/charmbracelet/bubbletea

nairadithya

BubbleTea is great, but it doesn't have support for Kitty Graphics. https://github.com/charmbracelet/bubbletea/issues/163

wonger_

And JS bindings: https://github.com/hectorm/chafa-wasm

And I'm half-working on Rust bindings...

hectorm

Author of the JS bindings here. I also have a browser demo: https://ansi-o-matic.molinero.dev

tasuki

> and it really is the best tool for terminal graphics in my opinion

Not sixel or kitty graphics?

hecanjog

What interests me about it is the unicode mosaic output format that looks higher quality than the usual upper half block or braille character approaches without needing to support a special protocol.

mmulet

One of the really cool things about chafa is that it has both sixel and kitty graphic renderers! (and iterm2 images as well) So you can output kitty if the terminal supports it, but fall back to ascii if it doesn’t.

robot-wrangler

Setting aside the usual compatibility issues with those things.. neither are available from your buildbot. Also while Jupyter does supports images other notebooking ecosystems may not, and anyway you need a file whereas chafa can work with streams.

lawlessone

i'm curious do you work entirely with a terminal and no desktop?

Chafa looks cool, i'd feel cool using it when i use a terminal but if really wanted to see an image id just open it in a image viewer.

n0um3n4

qué chafa!! all jokes aside, this provides infinite posibilities for my obsession with text-based apps/CLI.

cherrycreek00

I've been trying for like three hours to get this to show in-line images with w3m. Anyone got a config with that working?

atulvi

Why can't we have proper graphics on terminal? years ago I remember being able to use graphics.h to draw on MS-DOS terminal and print letters on it (text mode).

d-lisp

Did you try notcurses ? [0]

[0] https://notcurses.com/

null

[deleted]

gnabgib

Previously in 2022 (97 points, 31 comments) https://news.ycombinator.com/item?id=32797681

duffyjp

I threw together a utility for this with just the half character in 2018, I don't even remember why.

https://rubygems.org/gems/barf

The name does imply the image quality, fyi.

My solution is also multithreaded, in Ruby. :D

mmulet

I use chafa in term.everything[0], and I have nothing but good things to say about it! hpjansson is a great maintainer too, if anything even seems like it's wrong with chafa he will chime in with a fix or a suggestion[1] (I'm not the only one he does this with too [2][3]). I would definitely recommend this lib for anyone doing terminal graphics.

[0]https://github.com/mmulet/term.everything

[1]https://github.com/mmulet/term.everything/issues/5

[2]https://lobste.rs/s/qh6lil/chafa_terminal_graphics_for_21st_...

[3]https://github.com/wong-justin/vic/issues/1#issue-2586904982

carterschonwald

If you want some hilarious insanity: t try explaining ascii/terminal rendering to a text llm and see how it struggles

XorNot

Discovered this recently when I wanted to set my perfect retro feeling company logo onto the MOTD of some hardware so we'd have it on the serial port.