# Kzap - A Sixel-based terminal image renderer

**URL:** <https://ziggit.dev/t/kzap-a-sixel-based-terminal-image-renderer/17165>\
**Category:** Showcase\
**Tags:** llm\
**Created:** [August 10, 2026, 11:53am UTC](https://ziggit.dev/t/kzap-a-sixel-based-terminal-image-renderer/17165 "2026-08-10T11:53:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaify](https://ziggit.dev/user_avatar/ziggit.dev/kaify/32/9897_2.png) [@kaify](https://ziggit.dev/u/kaify)\
**Post date:** [August 10, 2026, 11:53am UTC](https://ziggit.dev/t/kzap-a-sixel-based-terminal-image-renderer/17165/1 "2026-08-10T11:53:16Z")

</div>

# PROJECT NAME: kzap

* * *

Project link: [https://codeberg.org/kaify/kzap](https://codeberg.org/kaify/kzap)

Well, it started with me wanting to write a shell for my PC that was minimal and good-looking. At that time i used Rust, so i started looking into gui libraries most of them didnt had zwlr\_layer\_shell support, i found that Iced-layer-Shell did existed but it didnt had kind of widgets i needed.

i found out of most the stuff on my pc already used gtk4 so i started writing my shell with gtk4 and gtk4-layer-shell and i was new to linux and i also discovered it also didnt had the kind of widgets i needed, and those were in libadwaita and those were locked into the GNOME design gtk4 itself felt kinda bloated for what i was trying to do pulling in the whole GNOME ecosystem that i didnt wanted on my pc.

I was also running a lfs-based system that i built myself, so i had much more control over what was being installed, i started removing the gnome related libraries GTK,gio,cairo,pango and so on.

i was using niri as my compositor, and parts of its was using cairo and pango since i was already remove the libraries, i ended up forking niri and rewriting those parts with cosmic-text and tiny-skia,  
link to the fork: [GitHub - kaifsyy/niri: A scrollable-tiling Wayland compositor. · GitHub](https://github.com/kaifsyy/niri)

at that time i was using foot as my terminal and it only supported sixel and other terminal was kinda slow, so i looked around for a tool found chafa it was using glib,  
i decided i write my own.

### Implementation:

One of the main things i did for performance is to not run the kmeans directly over every pixels, thats get expensive because the algorithm has to process a huge number of pixels, i first build the color histogram and run the quantization over the histogram itself, which reduces the amount of data kmeans need to work with.

### Supported Zig versions

- Zig 0.16.0
- Zig 0.17.0-dev

### AI / LLM usage disclosure

I used ai manily for learnings and as a debugging tool, i used it  
to explain algorithms and concepts i dont fully understood, help investigate bugs, reason about performance issue, and answer questions  
related to Zig.

it was not used to generate Project as a whole, i wrote and tested the code myself and used ai on stuff that i got stuck with or needed explaination of something.
