[Image-SIG] Re: Returning Colormap values for an image?
Fredrik Lundh
fredrik at pythonware.com
Thu Aug 12 10:42:21 CEST 2004
Alfred Milgrom wrote:
> Unfortunately I think I am missing something as far as the
> resize/convert technique is concerned. Basically I do not understand
> why all the colours will be preserved if the image is resized, nor why
> the colours will then be neatly arranged in the lut Image.
that's an interesting question: the example is broken, and you're the
first one who's noticed. oops! here's how it's supposed to look:
lut = im.resize((256, 1))
lut.putdata(range(256))
lut = lut.convert("RGB").getdata()
(the resulting lut object is now a 256-item sequence of (r, g, b) tuples;
use list(lut) if you want to print it)
</F>
More information about the Image-SIG
mailing list