[Image-SIG] Reading 16bit image
Thu, 22 Aug 2002 10:23:42 -0400
Wow, looks like you've done a lot of good work here. The ability for this=
library to read 16-bit images will be important in the future because so =
digital cameras are going to formats higher than 8 bits.
Thanks for your efforts!
On Wednesday 21 August 2002 05:07 pm, you wrote:
> With regard to 16 bit TIFF support:
> Please find attached
> - diffs for Imaging-1.1.3
> - changes sources of Imaging-1.1.3
> The changes sources are for when you don't have/know patch; in that
> caes just replace the source files. Otherwise use patch; recompile
> and re-install Imaging-1.1.3.
> What is changed in the sources:
> - ability to read 16 bit unsigned TIFF files using Image.open
> - ability to use Image.show (by adding convert to 'L' mode (uint8))
> - ability to use Image.getextrema and Image.point
> Image.show, Image.getextrema and Image.point all work similar to
> the 32 int cases; so something like:
> import Image
> im16 =3D Image.open('img.tif')
> min,max =3D im16.getextrema()
> scale =3D 255.0 / (max - min)
> offset =3D - min * scale
> im16c =3D im16.point(lambda i: i * scale + offset)
> will show a strechted image (sorry, typed from memory).
> Other PIL functions are not (yet ?) converted for 16 int use.
> Note that im16.convert('I') will give a 32 bit int image, which is
> better supported in PIL; or use im16c.convert('L') and have an 8 bit
> Feedback is appreciated!
> Klamer Schutte
> Klamer Schutte wrote:
> > Aureli Soria Frisch wrote:
> > > I submitted a while ago a question related to the possibility of
> > > opening TIF files with 16 bit depth that remained with no answer...
> > >
> > > It would be interesting to know how to work with 16 bit files in PI=
> > > in general (it does not seem to be possible with the open source
> > > version of PIL)...