24bit RGB | 256 color Indexed |
---|---|
Important
This crate isn't quite ready yet. There's some tuning and research to be done while selecting the palette. To get the best results you'll likely have to do some trial and error with the tolerance for your specific application.
colorsquash is a colour quantization1 crate and algorithm.
At it's core, it sorts the colors of an image by how frequently they appear, greatest to least. It then goes through those colours and takes the top N colours that are sufficiently different.
library features
gifed
- adds the Squasher::palette_gifed()
method allowing you to
directly get a gifed's Palette struct.
colour selection algorithms
Sorsel
- sorts colors most to least frequent and then picks the top colours that are different enough than the colours already picked.
KMeans
- use k-means clustering to select the palette.
HighestBits
- bit-shift the color components until all of the colors fit in the palette.
A CLI tool to quantize colours :D
Accepts JPEG and PNG as input and can output indexed PNG and GIF.