[Image-SIG] Re: 16bit PNG read/write supported ?

Sebastian Haase haase@msg.ucsf.edu
Thu, 8 May 2003 09:34:03 -0700


Thanks for the reply.
That PIL reads 16bit PNG is nice to hear! Can it also _write_ 16bit PNG ?
And since I have VERY large images I probably would need to have them loaded
to / written from "unsigned short" arrays instead of "signed long".
Does it make sence for me to look into the PIL source code  and where can I
get it ? Which _file_ should I  look at?

 Thanks again,
- Sebastian

> Sebastian Haase wrote:
>
> > I am about to start using PIL. We (BioChemistry department
> > at UCSF) are dealing with grayscale images that are 16
> > bits per pixel (if not floating point).
> > I read that the latest (beta) version of PIL should now
> > support 16bit TIFF images ...
> >
> > What is the status regarding 16bit gray images with PNG ?
>
> if I remember correctly, and interpret the code correctly, PIL reads
> 16-bit monochrome PNG files as mode "I" images (that is, it uses 32-
> bit internal storage).
>
> I don't have any 16-bit samples on this box (and no time to google
> for them), but roundtripping sure seems to work:
>
>     >>> import Image
>     >>> im = Image.new("I", (100, 100))
>     >>> im.putdata(range(10000))
>     >>> im.getpixel((50, 50))
>     5050
>     >>> im.save("out.png")
>
>     >>> im = Image.open("out.png")
>     >>> im.mode
>     'I'
>     >>> im.size
>     (100, 100)
>     >>> im.getpixel((50, 50))
>     5050
>
> </F>
>
>
>
>
> _______________________________________________
> Image-SIG maillist  -  Image-SIG@python.org
> http://mail.python.org/mailman/listinfo/image-sig
>