Remote-Url: https://hpjansson.org/blag/2021/09/16/chafa-1-8-terminal-graphics-with-a-side-of-everything/ Retrieved-at: 2021-09-19 18:00:40.603261+00:00 Skip to content • Github • Feed • E-mail • Blag • Chafa Et tu, Cthulhu Personal blag of H. P. Jansson: Free Software, Open Source mostly. Chafa 1.8: Terminal graphics with a side of everything On September 16, 2021 By Hans Petter Jansson In Computing, Technical The Chafa changelog was growing long again, owing to about half a year's worth of slow accretion. Hence, a release. Here's some stuff that happened. High-end protocols With existing choices of the old text mode standby and its friend, the most unreasonably efficient sixel encoder known to man, I threw Kitty and iTerm2 on the pile, bringing our total number of output formats to four. I think that's all the terminal graphics anyone could want (unless you want ReGIS; in which case, tough tty). Moar terminals Modern terminal emulators are generally less fickle than their pre-y2k ancestors. However, sometimes it takes a little sleuthing to figure out which extended features might be hiding behind e.g. some mysterious xterm-256color façade so we can do the right thing. Comparison of Chafa graphics in various terminalsChafa, friend to all terminals (sample picture mine: Las Canicas, Santa María del Tule) Luckily, Chafa has a steadily improving handle on terminals of the Unix/GNU/ Linux world. A few examples: • VTE-based terminals (there are many, including GNOME Terminal). • Sixel crew: foot, mlterm, WezTerm, XTerm. • A category unto its own: Kitty, packing one of the most featureful terminal graphics protocols around. • Another innovative beast of genetically engineered goodness: ctx. • Fullscreen consoles: fbterm (quirky!), yaft (yet more sixels!) and the Linux console. • Simple and sweet: st, urxvt. • For the Mac addicts: Apple Terminal, iTerm2. • Sessions running in screen and tmux. Of course, this is forever a work in progress and an area where I receive regular, highly appreciated contributions *chef's kiss – somehow still not an actual emoji*. Funky lo-fi features Øyvind Kolås (of GIMP and GEGL fame) swooped in with new builtins for the legacy computing block, meaning Chafa is now PETSCII Ready™ – or as ready as you can be with Unicode 13.0: The standard has a few annoying issues, such as not declaring any code points for the four permutations of black triangle, relying instead on existing code points in the geometric shapes block (U+25E2..U+25E5) which are typically represented by fonts as sitting on the baseline surrounded by empty space and therefore useless next to the legacy computing and block elements blocks. Still, it's got a sweet 2×3 dot matrix (--symbols sextant) and all those nifty wedge shapes (--symbols wedge). Symbols for Legacy Computing, excerptCan't not have these. Well, most of them, anyway Øyvind also added an 8-color mode. Used together (-c 8 --symbols legacy+space), these features enable visual emulation of Teletext Level 1 and similar systems widely deployed in the late 1970s until roughly 1990 (technically into the present, albeit perhaps not so widely anymore). PETSCII parrots rendered by ChafaPETSCII parrots; left: full color, right: 8 colors Somewhere along the way I discovered that Øyvind has a Patreon page – and if you're a GIMP user and/or care about the free software graphics ecosystem, you may want to read this article and consider its implications. A bit of background austerity I followed up in the retro vein with a foreground-only (--fg-only) modifier, which allows emulation of vintage systems that could only specify a single color per cell against a uniform background color. A popular example is the Commodore 64's standard character mode. It's also useful in terminals where block symbols don't render correctly (for example due to missing font support), since it prevents background color variation from drowning out details in low-coverage symbols used in their place. The Linux console tends to be among these due to hardware and font limitations that are somehow still in play today. This is also how many classic ASCII art packages did things; so I guess I am once again asking you to party like it's 1999 (…and stay up all night trying to make your Napster killer render with AAlib). ASCII parrots rendered by ChafaLeft: 16-color ASCII on black, right: same, but on light gray using --invert When used with --fg-only, the existing --bg option has a greater impact than usual; in addition to being the fade color for alpha blending, it determines the relationship between symbols and blank space, including symbols where the background color "wins" part of a cell. A dark image on a bright background will have more high-coverage symbols that cover up the background as much as possible. If your terminal has a bright background color, --invert is a shortcut to inverting the sense of --fg and --bg; the white-on-black default then becomes black-on-white. Since foreground-only mode leaves the background color alone, you can easily experiment with setting it yourself, e.g: echo -e '\033[41m'; \ chafa -c 16 --symbols ascii --fg-only --bg darkred birbs.png Weird and wonderful forum art redux If you read Steam reviews, you may be familiar with this guy: [steam-shrek-braille-1]Oh, hello there to you too There are layers to this, but I'll keep it brief and simply observe that people seem to like braille. Braille is popular in this context for at least four reasons. It has: • A luxurious 2×4 dot matrix at your fingertips. • Widespread font support. • Consistent glyph width even in variable-width fonts. • A special blank symbol (U+2800 BRAILLE PATTERN BLANK) for consistent spacing. Chafa's supported this kind of output for a long time (-c none --symbols braille), but in some circumstances it could replace cells having identical foreground and background colors with a hardcoded U+0020 as an optimization. This could result in inconsistent spacing, making braille (and probably other symbol combinations) less useful. Fortunately the issue is now a thing of the past; the latest version will instead use a visually blank symbol from the user's symbol set, falling back to the lowest-coverage symbol it can find. The GPL doesn't regulate netiquette: Please use for good, or in extreme cases, awesome. The ever elusive practical application in the wild hb-view screenshotحرف‌باز It's good to be useful. Neofetch was the first project to avail itself of Chafa's incredible power, and the latest is HarfBuzz' hb-view. And – er – I think that's all of them. For now! ⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣶⣄⣀⡀ ⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣦⣄⣀⡀⣠⣾⡇ ⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇ ⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⢿⣿⣿⡇ ⣶⣿⣦⣜⣿⣿⣿⡟⠻⣿⣿⣿⣿⣿⣿⣿⡿⢿⡏⣴⣺⣦⣙⣿⣷⣄ ⣯⡇⣻⣿⣿⣿⣿⣷⣾⣿⣬⣥⣭⣽⣿⣿⣧⣼⡇⣯⣇⣹⣿⣿⣿⣿ ⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠸⣿⣿⣿⣿⣿⣿ Tagged with ansi art, ascii art, chafa, graphics, petscii, release, terminal graphics, unicode Post navigation Previous Post Chafa 1.6.0: Wider 5 comments 1. Pingback: Links 16/9/2021: KStars 3.5.5 and Chafa 1.8 | Techrights 2. [ca025e] Holger Hoefling says: September 16, 2021 at 17:23 Really awesome 🙂 Thanks Reply 3. [4e4110] eTM says: September 16, 2021 at 20:48 Thanks for chafa, but also for the sixel vte work you are doing (it works very well, but its inclusion into release is more a marathon than a sprint :-). Reply 1. [27b1ed] Hans Petter Jansson says: September 16, 2021 at 23:02 Thanks 🙂 Re. marathons – actually it's been languishing and I need to get back and pull it across the finishing line soon. There's been a lot going on recently and it's been easier to put the bonus hacking time I get here and there into Chafa, since it's code I already know well. Reply 4. [316beb] kls0e says: September 18, 2021 at 08:46 many thanks! Reply Leave a Reply Cancel reply Your email address will not be published. Required fields are marked * [ ] [ ] [ ] [ ] [ ] [ ] [ ] Comment[ ] Name * [ ] Email * [ ] Website [ ] [ ]Notify me via e-mail if anyone answers my comment. [Post Comment] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ]