Hello,
I found, that the mentioned problem is because of RESOLUTION_UNIT tag.
It looks like it has wrong number. Around line 635 in
TiffImagePlugin.py:
# additions written by Greg Couch, ***@cgl.ucsf.edu
# inspired by image-sig posting from Kevin Cazabon, ***@home.com
if hasattr(im, 'tag'):
# preserve tags from original TIFF image file
for key in (RESOLUTION_UNIT, X_RESOLUTION, Y_RESOLUTION):
if im.tag.tagdata.has_key(key):
ifd[key] = im.tag.tagdata.get(key)
here, ifd[key] gets vaule: (3, '\x02\x00') and ol32 doesn't like this.
When I reqrite ifd[key] = 0x2, it is OK (I know, this is a very ugly
hack).
Other:
I wanted to save tiff files in G3 format, is it hard to build it into
this patch? I mean using libtiff for this work also.
Thanks in advance,
Thomas
Thursday, December 11, 2003, 11:58:50 AM, you wrote:
eah> Hello Fredrik,
eah> many thanks!
eah> Does anybody know when will be a new PIL available including this
eah> patch?
eah> I applied a patch. I was able to open TIFF G3 files but got this when
eah> I tryed to save:
eah> Traceback (most recent call last):
eah> File "./tiff.py", line 36, in ?
eah> im.save("/tmp/test_o.tiff")
eah> File "/usr/local/lib/python2.3/site-packages/PIL/Image.py", line 1136, in save
eah> SAVE[string.upper(format)](self, fp, filename)
eah> File "/usr/local/lib/python2.3/site-packages/PIL/TiffImagePlugin.py", line 684, in _save
eah> offset = ifd.save(fp)
eah> File "/usr/local/lib/python2.3/site-packages/PIL/TiffImagePlugin.py", line 357, in save
eah> data = string.join(map(o32, value), "")
eah> File "/usr/local/lib/python2.3/site-packages/PIL/TiffImagePlugin.py", line 55, in ol32
eah> return chr(i&255) + chr(i>>8&255) + chr(i>>16&255) + chr(i>>24&255)
eah> TypeError: unsupported operand type(s) for &: 'str' and 'int'
eah> Does anybody know what's wrong?
eah> Thanks,
eah> Thomas
Post by e***@axelero.hudoes anybody have TIFF G3 compression implemented for PIL?
FL>> this might be helpful:
FL>> http://mail.python.org/pipermail/image-sig/2003-July/002354.html
FL>> </F>
_______________________________________________
Image-SIG maillist - Image-***@python.org
http://mail.python.org/mailman/listinfo/image-sig