---
title: "sriv: simple rust image viewer"
date: "2025-10-22"
---


I vibe-coded an image viewer in Rust!

![Screenshot](sriv-screenshot.png)

:: github https://github.com/dllu/sriv

For years, I've been using simple X image viewer [sxiv](https://github.com/xyb3rt/sxiv), and when the developer abandoned it, I switched to [nsxiv](https://github.com/nsxiv/nsxiv).
Overall, I love it because of its extremely minimalistic UI without any toolbars or GUI elements, vim-like keybindings, overall speed, and support for custom keybindings to execute custom commands.
I have some commands to upload photos to my website, and to edit photos in [darktable](https://www.darktable.org/), which are super handy.

But several issues with `nsxiv` started to become annoying.

- It's built on `imlib2`, but it crashes for large images. Since I have a 100 megapixel camera and also do [line scan photography](/blog/2025-09-21-line-scan-camera-image-processing/) which regularly produce images over 100,000 px wide, I needed something that could handle large images.
- Thumbnailing was single threaded and really slow. With my 100 megapixel photos, it would take about a second for each thumbnail to generate. I'm not super sure about how `nsxiv` manages its thumbnail cache, but it would sometimes regenerate thumbnails that I'm pretty sure I've already generated in the past.
- It requires X11 so it doesn't work natively in Wayland and I would occasionally get some random X-related quirks like `X11 error: BadValue` when using certain tiling window managers like i3.
- Configuration is via `Xresources` which can get reset when using `XWayland`.

So I created `sriv` which addresses these issues.

- minimalistic UI with vim-like keybindings and looks and feels almost identical to `sxiv` and `nsxiv`.
- gpu-accelerated image viewing
- parallel thumbnail generation
- supports images more than 32768 or 65536 px wide or whatever arcane limit that imlib2 has
- works in wayland natively thanks to nannou using wgpu/winit
- custom keybindings are via `~/.config/sriv/bindings.toml`; configuring other stuff like background color are soon to be added

I also added some optimizations like eagerly trying to prefetch the full size image when you are browsing around in thumbnail mode.

Finally, I implemented [CLIP-powered semantic search](https://github.com/openai/CLIP) across the image library!
Now I can just press `/` and type in what I need to find.
This is incredibly useful for finding photos in my library of tens of thousands of images.

I used [Codex CLI](https://github.com/openai/codex) to vibe code this and the codebase is just under 3000 lines of code (still less than `nsxiv`'s 5000 lines of C, although I'm standing on the shoulders of giants by pulling in enormous crates as dependencies).

Feel free to raise any issues or suggestions on GitHub!
