Home

Awesome

svitlyna

A "full-color" image viewer for the Uxn/Varvara 8-bit computer. This is mostly an experiment and an excuse for me to play around with dithering and color quantization.

The word "svitlyna" is a Ukrainian word for "picture" or "photograph". The "i" is pronounced like "free", "y" is pronounced like in "system".

Note that the Varvara computer specification only supports a palette of 4 colors, however those colors can be selected by the program. This is not enough to cover the whole RGB color space no matter how hard you try, but Svitlyna still tries her best.

See the showcase for example images.

Features

Usage

There is currently no friendly graphical UI. There is also no file picker from within the program.

To display an image, provide a filename as an argument through the command-line:

uxn11 svitlyna.rom image.ff

Press [UP] or [DOWN] to browse color palettes.

Press [A], aka Ctrl on desktop keyboard, to automatically pick a color palette based on the image, but note that this is currently slow.

Press [B] aka Alt to switch render modes. You can enable or disable dithering this way. For the auto-color mode, there are extra modes with slightly different rendering.

To-do / ideas

Some notes on color

If you look at the showcase images you might notice that the median cut algorithm can produce somewhat washed-out colors. This is because this algorithm attempts to find the "average" colors, which can approximate a majority of the pixels.

This is good when you don't do any dithering, however, with dithering, this may not be necessarily the best approach. A simple color preset like Red-Green-DarkBlue-White can achieve arguably better results.

Think of the RGB color space as a 3D cube. If you have one color, that's a point within the cube. If you have two colors, that's two points, however with dithering we can interpolate between the two colors, thus we get a line segment. With three colors we form a triangle, and with the 4 colors of Varvara we get a tetrahedron of colors.

However, you cannot "fill" the color cube with a tetrahedron. The closest you can get is by picking "extreme" colors that cover a large volume, and letting dithering take care of the colors within it. The optimal simplex is dependant on the pixel color values within a given image.

So mathematically this becomes a problem of finding a tetrahedron, embedded within a cube, which covers the maximum number of color value points from the given image. But, I don't know how to solve this yet.