kornelski / pngquant

Lossy PNG compressor — pngquant command based on libimagequant library
https://pngquant.org
Other
5.19k stars 483 forks source link

[feature request] constraint colors from given palette #387

Closed tobwen closed 2 years ago

tobwen commented 2 years ago

wish

Would it be possible to add a constraint to always include colors from a given palette?

background

I'm often working with small images (256x256 or 512x512 pixels), which have lots of super-anti-aliasing. In very few cases, one of the "important colors" is shifted a bit (to equal a color that looks similar). So it would be nice to give a palette and say: "Whenever one of these colors is in the image: use it and change others".

kornelski commented 2 years ago

The libimagequant API has support for fixed palette entries.

The CLI version has an undocumented -map pal.png option that uses colors from the given file.