"James Hu" wrote:
> I have png file with mode "I", 16 bit,
> And I tried to open it with im=Image.open("output.png"), im.show()
> I got all white image.
> Don't why?
because all of the PNG file are larger than 255 ?
show doesn't support 16-bit images, so it clamps the values down to
an 8-bit range. adding a
print im.getextrema()
will tell you what values you have in the image (it returns min and max).
to scale things down before you display it, you can use something like:
im = im.point(lambda x: x*(1.0/256))
or
lo, hi = im.getextrema()
if lo == hi:
im = im.point(lambda x: 128) # or something
else:
scale = 255.0 / (hi - lo)
offset = -lo * scale + 0.5
im = im.point(lambda x: x*scale + offset)
</F>
--
http://mail.python.org/mailman/listinfo/python-list