[Image-SIG] Problems converting multi-layered TIFF images
feroze dawood
feroze.dawood at gmail.com
Tue Oct 23 05:45:01 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/20121022/98f30212/attachment.html>
More information about the Image-SIG
mailing list