Number of colors in an image
Laszlo Zsolt Nagy
gandalf at geochemsource.com
Fri Nov 26 18:56:28 EST 2004
Hello David,
Friday, November 26, 2004, 11:18:04 PM, you wrote:
> For example, for an RGB image:
> import sys
> from PIL import Image
> from itertools import izip, repeat
> if __name__ == "__main__":
> im = Image.open(sys.argv[1])
> r = im.getdata(0)
> g = im.getdata(1)
> b = im.getdata(2)
> print 'Number of colors =', len(colors)
Thank you, this was very helpful. I'll try to use this one instead of
ImageMagick. (The identify program does not work in some cases...)
--
Best regards,
Laszlo
mailto:gandalf at geochemsource.com
web:http://designasign.biz
More information about the Python-list
mailing list