[Image-SIG] Questions about a 16bpp TIFF

Daniele Varrazzo dvarrazzo at virgilio.it
Mon Oct 25 01:42:37 CEST 2004


Hi everybody,

i am trying to use PIL for a 2d electrophoresis gel images database. Those
images are TIFFs obtained from a densitometer, so lower values are
interpreted as white. The precision is 16bpp. This combination yelds a key
(0, 1, (16,), ()) for OPEN_INFO, but there is not such entry, so the opening
fails.

Can those images be opened through PIL by simply adding a new key to
OPEN_INFO or the workaround is more complex? What values?

By now i tried duplicating the values for (1, 1, (16,), ()) and inverting
the image.

I need to convert the image into something suitable for the web, i.e.
downsize it and store into an 8 bit jpeg. It looks like Image.convert('L')
simply crops what's more than 255, so i should multiply each pixel for 1/256
before converting. How can i do it? The only way looks like
	ImageChops.add(img, ImageChops.constant(img, 0), 1.0/256)
but it can't be like that! Both because creating and adding zeros looks like
a waste of time and because it doesn't work for 16bpp images. How can i
convert a 16bpp grayscale image into an 8bpp without a level rescale instead
of a cropping?

Some hardware return a 12 bpp image, so only 8192 from 65536 gray levels are
actually used. Thus the multiplying factor should take into account the max
gray level. But getextrema returns None, even if the manual states it works
for single plane images. Is it a bug "or a feature"?

Is PIL the right package for my needs? Is there any easy way to obtain a
numeric or numarray matrix from the image to freely work over it?

To get a copy of the image i am talking about, you can download and install
the demo version of the ImageMaster program at
http://promo.amershambiosciences.com/INTL/imagemaster_demo/
and play with the file C:\Program Files\Amersham Biosciences\ImageMaster 2D
Platinum Trial\Gels\ECOLI.mel (it is a TIFF image with some extra tags) or
ask me for some image (if you don't want to download the 12MB package).

Any help would be appreciated. Thank you in advance.

Daniele



More information about the Image-SIG mailing list