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 has all the
information needed to write a fully functional color reduction tool.
Part two introduces practical tricks everyone uses but textbooks
often ignore such as palette color selection for ordered dithering.
Part three discusses more advanced methods from the academic
literature, for example different k-means initialization schemes and
PCA-based top-down clustering.
Table of contents
Contents and chapter order are still subject to
change.
Part 1: Setting the Standard
- Popularity and bit cutting
- The trivial median cut
- Palette refinement with K-means
- Cutting by variance
- Error diffusion dithering
Part 2: Practical Improvements
- Structure-preserving dithering
- Ordered dithering
- Image preprocessing
- Perceptual color spaces
- Alpha difference formula
Part 3: Flights of Fancy
- k-means as a color quantizer
- Top-down clustering via 2-means
- Wu’s Famous 1991 Technique
- The axis of greatest variation
- Combined reduction and dithering
From the author
January 5th, 2026
Hello! My name is Pekka Väänänen and I’m a software engineer. This
book started when 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.
News
- April 23rd, 2026
- Table of contents updated with more dithering related chapters.
- Book subtitle changed to better reflect the new content.