Updates on the book
Are you interested in news on Palette Programming such as new sample chapters? Then subscribe to the book
waiting list below.
Updates at most once per month. Unsubscribe any time.
The book will be published in 2026. First as a
digital edition, followed by a printed physical version. The digital
format is a PDF in both full-size and smaller e-reader form factors.
See how it looks below↓ or check out the table of contents.
Book information
- Release date
- 2026 (planned)
- Author
- Pekka R. H. Väänänen
- Format
- A5, full-color, 250 pp. Ring-bound softcover.
PDF, e-reader PDF.
- Cover design
- Janya Markevich
How it’s structured
The first third of the book is a step-by-step guide to writing a
“baseline” algorithm that’s both simple and effective. It’s a great
project for anyone interested in developing their skill as a
programmer.
Part two introduces practical tricks everyone uses but textbooks
often ignore such as bit cutting and RGB dithering.
Part three discusses more theoretical aspects such as different
k-means initialization schemes, perceptual color spaces, and code
optimizations.
Table of contents
Contents and chapter order are still subject to
change.
Part 1: Setting the Baseline
- Image
Processing in Python
- The Trivial Median Cut
- Refinement with K-means
- Cut by Variance
- Simple Ordered Dithering
- Real-World Software Investigation
Part 2: Practical Improvements
- Histograms & Bit Cuts
- Ordered Dither Color Selection
- Error Diffusion Dithering
- Pixel Mapping Tricks
- How to Deal with Transparency
- Perceptual Color Spaces
Part 3: Theoretical Advances
- MSE vs SSIMULACRA
- Optimized Variance Calculations
- Locally Optimal Cuts
- Wu’s Famous 1991 Technique
- Going All In on K-Means
- PSOATCQ is SOTA
From the author
January 5th, 2026
Hello! My name is Pekka Väänänen and I’m a software engineer and a
writer. This book started in spring 2025 with a broader graphics theme,
but when working on a Nintendo
64 lighting experiment, I became obsessed with the color
quantization problem. A lot of what I learned from reading open source
code such as libimagequant and
exoquant.c wasn’t
mentioned in any textbook. I then initiated excavations in the academic
literature, and discovered remains of even more techniques unknown to
the general public. That’s how the book concept started to form.
I love programming and started trying out different color
quantization algorithms myself, building the experimental VariQuant GUI tool in
the process. Numerical programming has been my hobby since 2013 when I
participated in Andrew Ng’s popular Machine Learning online
course. That’s why the code in the book is in Python: it’s the standard
tool in this field.
But why should anyone study this old stuff? Didn’t
we evolve beyond 256-color GIFs for a reason? Sure, display technology
has improved, but I sincerely believe we should use old computers for
longer. Producing electronics takes a lot of energy and natural
resources. Both are something we should conserve.
Real progress involves learning new ways to do old things better, and
not just relying on hardware advances for new capabilities. I hope by
popularizing the art of color quantization I’ll encourage others to work
on better tooling for retro platforms, which should lead to a higher
appreciation of aging hardware. The same techniques can also be applied
in modern software, for example to optimize image sizes on the web to
lower data transmission costs.
–Pekka
Author bio
Pekka R. H. Väänänen (M.Sc. computer science) is a software engineer
who writes about computer graphics on his website at 30fps.net.
He has worked on 3D model streaming and robot simulations at Umbra,
and with 3D reconstruction and VR headset tracking at Varjo.
He also hacked on 2D graphics drivers as an intern at NVIDIA, a long
time ago.