[Image-SIG] Re: Tiff g3

ewc at axelero.hu ewc at axelero.hu
Thu Dec 11 07:41:25 EST 2003


I found, that the mentioned problem is because of RESOLUTION_UNIT tag.
It looks like it has wrong number. Around line 635 in
    # additions written by Greg Couch, gregc at cgl.ucsf.edu
    # inspired by image-sig posting from Kevin Cazabon, kcazabon at home.com
    if hasattr(im, 'tag'):
        # preserve tags from original TIFF image file
            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

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,

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

eah> Thursday, December 11, 2003, 10:47:38 AM, you wrote:

FL>> "Thomas" <ewc at axelero.hu> wrote:

>>> does 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>

More information about the Image-SIG mailing list