kornelski / ImageAlpha

Mac GUI for pngquant, pngnq and posterizer
https://pngmini.com
GNU General Public License v2.0
470 stars 63 forks source link

Unique color count #22

Closed Crissov closed 9 years ago

Crissov commented 9 years ago

ImageAlpha should tell me how many unique colors my image contains or it should limit the upper bound to that.

kornelski commented 9 years ago

What would you use that information for?

Crissov commented 9 years ago

To not select more colors than I actually need in pictures with very few colors.

kornelski commented 9 years ago

If the number of colors is lower than 256, then you don't need to worry about it, because:

If the number of colors is higher than 256, then to figure out if that's good enough, there's no better way than looking at the actual image :)

The raw number doesn't mean much — you can have an image that has 256 different colors and tiny barely noticeable noise that bumps the count to 2000 unique RGB combinations, but it'll look fine in 256. Or you can have an image with a rainbow of 300 colors that will look worse when 40 colors are removed.

Crissov commented 9 years ago

I see, but this is more of a user experience issue than a technical one. As a casual user I won’t know such details. Think of it as a “lossless threshold” indicator that provides a fuzzy feeling of assurance that I’m not destroying my picture without looking at it closely.

You are right of course, that a mere count cannot cover cases of similar colors – heck, reducing colors can sometimes remove prior compression artifacts (but also anti-aliasing). A histogram would help with that, but I understand that the workflow of ImageAlpha mostly relies on visual inspection.

kornelski commented 9 years ago

If you're willing to trust an algorithm, then I suggest using ImageOptim 1.6 with lossy option, which has this "lossless threshold".