Introducing Chafa

Chafa logo

Here's something I didn't know: The DEC VT100 turns 40 in August. This factlet comes courtesy of Wikipedia, as I'm not quite old and wise enough to have made its acquaintance outside of a museum. None the less, the VT100 and its extended family of hard-working office furniture has always been with me in terms of the ECMA-48 standard, better known as ANSI X3.64 or simply (and these days, probably as accurately as any formal descriptor) "ANSI codes", which it helped pioneer.

This pinnacle of 1970s UX is somehow still going strong, and recent developments like lots and lots of colors, ubiquitous Unicode support, good monospace fonts, etc. have opened up some interesting possibilities for creative abuse in a rich tradition that dates all the way back to manual typewriters, if not further. Previous entrants in this category are the venerable aalib and libcaca, and more recently there's timg and others that use the U+2580 half-block symbol.

I wrote a small tool to further improve on this. It combines a range of Unicode symbols in an attempt to minimize the squared error of the output, and has plenty of bells and whistles besides. Check it out.


    1. If you build it with a fairly recent ImageMagick, it should be able to convert Sixel images to Unicode+ANSI without any extra work. Outputting to Sixel would be interesting to look into — I think there are several tools that do it already, and maybe those are already as good as it gets. But it might be worth doing anyway for completeness.

      1. The Unicode half-block method is weaksauce compared to sixels. It's sad that most terminal emulators these days don't really "emulate" much at all — they' just implement the easy, lowest common denominator stuff and call it good. libvte is especially egregious in this regard.

        1. That may be so, but if half-block is like Heinz ketchup and sixels is habanero, with Chafa you can now whip up a batch of quite delicious chipotle 🙂

    1. Thanks for the link! Egmont has some good points on that bug. Fitting native pixel graphics into a character cell model isn't an easy task.

Leave a Reply

Your email address will not be published. Required fields are marked *