Francisco José Seva Mora wrote:

> 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.

the easiest way to add a palette to an image is to create a mode "L" 
image, and then use the "putpalette" method:

     im = ...
     im.putpalette([r0, g0, b0, r1, b1, g1, ..., r255, g255, b255])

(you can use a 768-byte string as well).

hope this helps.

</F>

_______________________________________________
Image-SIG maillist  -  Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig

Reply via email to