libvaxis icon indicating copy to clipboard operation
libvaxis copied to clipboard

Support Octants as a fallback for image rendering

Open VarLad opened this issue 11 months ago • 3 comments

Octants from Unicode 16 are probably the best fallback for good looking image rendering without using an image protocol. As far as I'm concerned, foot supports it now so I would have no issues with Octants as a replacement for Sixels for rendering images for now as well.

VarLad avatar Dec 15 '24 05:12 VarLad

This looks really promising. I wonder if there are good algorithms to somehow match a set of pixels to the "best" glyph. I have brute forced this with half-blocks before, but there are a lot more combinations when it comes to octants...

I do intend to add a block rendering fallback at some point, and octant would be my preferred way to do it given the extra fidelity.

rockorager avatar Dec 15 '24 13:12 rockorager

I wonder if https://github.com/hpjansson/chafa/commit/c23d8bc8d49919a4c78a564298d74b3e62f3b3e6 helps.

VarLad avatar Dec 15 '24 15:12 VarLad

One way would be to make each cell region its own "image", then resize it to 4x2, then quantize it down to two colors. The resulting image could be mapped to a single byte, with each bit corresponding to the state of that pixel (ie which color of the two it has). From there, we directly map to a box drawing character that matches (we have to do the inverse if we don't match on the first pass)

rockorager avatar Dec 15 '24 19:12 rockorager