Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color Quantization #256

Open
olivervogel opened this issue Jan 7, 2025 · 2 comments
Open

Color Quantization #256

olivervogel opened this issue Jan 7, 2025 · 2 comments

Comments

@olivervogel
Copy link

Is it possible in any way to reduce the distinct colors in an image with the result being visually similar as possible to the original?

I have found out that I can achieve this by setting the palette and bitdepth parameters when encoding to PNG format.

The question I am asking myself is whether this is also possible outside or before the encoding process and without committing to a certain image format. And if this is the case, is it also possible to reduce to any number of colors instead of fixed bit depths?

Thanks in advance.

@jcupitt
Copy link
Member

jcupitt commented Jan 7, 2025

The GIF saver has this functionality too, though it's also limited to a choice of 2, 4, 8, 16, 32, 64, 128, 256 colours.

There's a PR with some code to expose this as a general operation, but it hasn't been merged because of some upstream issues.

@olivervogel
Copy link
Author

Ok thanks, looking forward to it being possible in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants