[Image-SIG] ImagePalette class problem

Francisco José Seva Mora franciscojseva at gmail.com
Sat Jun 2 17:59:13 CEST 2007


Hello!! I'm trying to use the  ImagePalette class from PIL ( python image
library ) to load a dicom image that I have decoded. I read the official
documentation and many other articles from blogs and webs but many of them
are copies of the official documentation.
I'm trying to use this class to set the right palette to the image because I
think the default palette  don't have  the  necesary   scale  to represent
the image.

To load the image I use this code :
                   imagen=Image.frombuffer( "P",
(self.__width,self.__height), self.__data, "raw", "P", 0, 1)

and the code to treat the bytes of the image is :
                   for i in range(self.__width*self._ _height):
                             self.__data.insert(i,(0xff & img[(2*i)+1]<<8 )|
0xff & img[(2*i)] )

I supose that it is a 16 bits monocrome image.

Someone knows how to set a palette?? or a link to read something about it??
Thanks


Francisco J. Seva


-- 
blog: www.lacoctelera.com/nupi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/image-sig/attachments/20070602/5f94ca09/attachment.html 


More information about the Image-SIG mailing list