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

Feature Request: Option to skip image if it already has 256 colors or less. #397

Closed
trlkly opened this issue Dec 11, 2022 · 2 comments
Closed

Comments

@trlkly
Copy link

trlkly commented Dec 11, 2022

I mostly use pngquant to convert images to 8-bit palleted PNG (aka PNG8). Most of the time, it works great. But occasionally the image I started with already had less than 256 colors, and the result is usually that this gets reduced to a much lower number of colors.

I would prefer an option to tell it to skip the image if it has 256 colors or less. You already do check the number of colors as part of the conversion process, so it would be nice to say to skip reducing the colors of images if there are few enough colors. (Perhaps you could even set the number of colors.)

I do currently have a workaround in a batch file that uses ImageMagick to check the number of colors but it would be nice if pngquant could do it natively, since it already checks the number of colors. It would further be nice if it would still convert the image to PNG8, though this is optional since I optimize the PNG.

@kornelski
Copy link
Owner

I assume you're using it with the --quality option that doesn't allow preserving 100% quality? Because otherwise it should just keep the input colors. Any difference may be from unused colors.

@trlkly
Copy link
Author

trlkly commented Dec 12, 2022

I copied the settings from a project, and they used 99, not 100. I assumed 99 was the max. You're correct, if I allow 100, it does keep the file.

@trlkly trlkly closed this as completed Dec 12, 2022
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