octreequantisatie
Octree quantization is a color quantization algorithm used in computer graphics to reduce the number of colors in an image while trying to preserve the visual appearance. It is particularly useful for reducing the bit depth of an image, for example, when converting a 24-bit true-color image to an 8-bit indexed color image. The core idea is to represent the image's color space with a tree-like data structure called an octree.
The octree is built by recursively subdividing the color space. Initially, the entire RGB color cube is
Once the octree is constructed, it is pruned to create a limited number of representative colors. Leaf
When an image with reduced colors is generated, each original pixel's color is mapped to the closest