Color count in PIL

Larry wrbt at email.com
Thu Jan 29 16:26:48 EST 2004


wrbt at email.com (Larry) wrote in message news:<2ec1bc1c.0401271443.15f56742 at posting.google.com>...
> I've been walking up, down, and around instances in the object model
> of PIL trying to figure out how to easily calculate how many unique
> colors are used in an image, specifically a bitmap (mode "P"). Am I
> missing something?
> 
> Thanks python friends!

So far I have: colors=len(sets.Set(list(im.getdata())))

That makes me want to throw up.



More information about the Python-list mailing list