[Tutor] Image Question, List of Image Colors

Kent Johnson kent37 at tds.net
Thu Jan 11 13:46:53 CET 2007


Carlos wrote:
> Hello,
> 
> Could someone who is familiar with image manipulation tell me what is 
> the best way to obtain the list of colors inside an image?
> 
> By best I'm referring to something that gets the job done in the fastest 
> way, because this operation will be repeated a number of times.

The Image object in the Python Imaging Library has a getcolors() method 
that seems to do what you want.
http://www.pythonware.com/library/pil/handbook/image.htm

Kent



More information about the Tutor mailing list