[Image-SIG] Unable to read multilayered TIFF images using PIL 1.1.7
feroze dawood
feroze.dawood at gmail.com
Thu Oct 25 05:22:07 CEST 2012
I am doing some image processing on images. I use PIL to resize the images.
The image in question is a multilayered TIFF image. When I run it through
my code, all I get is an image with a green background and no detail. It is
as if the image is being corrupted, or not being read correctly by PIL.
I have got the repro case down to a few lines of python code.
--
import os
import sys
import Image
import ImageFile
import StringIO
data = None
with open(sys.argv[1]) as fp:
data = fp.read()
img = Image.open(StringIO.StringIO(data))
print img.format, img.size, img.mode, img.getbands()
#img.show()
img1 = img.convert("RGB")
print img1.format, img1.size, img1.mode, img1.getbands()
#img1.show()
out = StringIO.StringIO()
img1.save (out, "JPEG" , quality=95)
with open(sys.argv[2], 'w') as f:
f.write(out.getvalue())
--
At each step if you comment out the img.show() I get an image with a green
background, and no detail
I pass in <inputfile> <outputfile> as arguments to this tool
Here is the source image URL: http://feroze.s3.amazonaws.com/ptiff_file.jpg
Any idea what I am doing wrong?
Thanks,
feroze.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20121024/7496ef3a/attachment.html>
More information about the Image-SIG
mailing list