Sebastjan Trepca wrote: > I was wondering is it possible to find out which colour is dominant in an > image using PIL? > It would be very easy to create interesting mozaic images with that :)
some alternatives: >>> i = Image.open(...) >>> i.quantize(1).convert("RGB").getpixel((0, 0)) (208, 205, 202) >>> import ImageStat >>> s = ImageStat.Stat(i) >>> s.mean [208.32295432458699, 204.56614188532555, 202.44663427275671] >>> i.resize((1, 1), Image.ANTIALIAS).getpixel((0,0)) (212, 212, 210) (quantize will only return colors that actually exist, the other two uses different ways to calculate some kind of average color) </F> -- http://mail.python.org/mailman/listinfo/python-list