libvaxis icon indicating copy to clipboard operation
libvaxis copied to clipboard

Support sixel format for images

Open Ratakor opened this issue 1 year ago • 1 comments

Support sixel format for images. This can be useful on terminal that don't support kitty graphics but support sixel.

Ratakor avatar Sep 11 '24 12:09 Ratakor

On Wed Sep 11, 2024 at 7:38 AM CDT, Ratakor wrote:

Support sixel format for images. This can be useful on terminal that don't support kitty graphics but support sixel.

I am very much on the fence about supporting sixels, and leaning towards not supporting them. My preference for these terminals would be to support half-block rendering of images. Yes, the fidelity will greatly suffer however bringing in sixel support is not a small task. Libsixel is not very performant (perhaps that has improved), and I'm hesitant to bring in a C lib on top of that because right now we don't require linking libc.

The very first step would be having a crossplatform zig library that encodes images to sixels.

I'll keep this issue open for discussion.

rockorager avatar Sep 11 '24 14:09 rockorager

I can offer my library that I wrote because I saw this message, at the moment it is implemented in C, but for those who know Zig it will not be difficult to port it. https://github.com/seityaya/sixel_c

seityaya avatar Oct 24 '24 21:10 seityaya

I can offer my library that I wrote because I saw this message, at the moment it is implemented in C, but for those who know Zig it will not be difficult to port it. https://github.com/seityaya/sixel_c

@seityaya This is looking really good. Do you have any benchmarks compared to libsixel? I know dnkl in particular has been critical of libsixel's performance, and such a simple library in C would be greatly appreciated in many projects.

rockorager avatar Oct 25 '24 17:10 rockorager

@rockorager I have not compared the performance of the algorithm with other implementations. In the gif example, a raw 400 by 400 24-bit rgb image is converted to a sixel sequence in one core in ̶0̶.̶1̶ ̶s̶e̶c̶o̶n̶d̶s̶ ̶o̶r̶ ̶1̶0̶ ̶i̶m̶a̶g̶e̶s̶ ̶p̶e̶r̶ ̶s̶e̶c̶o̶n̶d̶. Depending on the palette and the size of the image, this figure can vary widely.

release on and optimisation last commit image 71 images per second

seityaya avatar Oct 25 '24 19:10 seityaya

@rockorager Would you be willing to accept something like Chafa instead? It has much better support for sixels (both in speed and quality, as evident from https://github.com/hpjansson/chafa/issues/174#issuecomment-2489241676 ), but also supports: ITerm2 Inline Images protocol, as well as Kitty Terminal Protocol. It also supports Octants from Unicode 16 for image rendering (more on those here: https://github.com/microsoft/cascadia-code/issues/711 ). Has a neat C API as well.

I found out about this through dnkl's post on Treehouse https://social.treehouse.systems/@dnkl/113519559551012343 :P

VarLad avatar Nov 24 '24 19:11 VarLad