Phatch doesn't support decoder group4 TIF

Bug #234788 reported by Bálint Magyar
20
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Phatch
Fix Released
High
Stani
python-imaging (Ubuntu)
Fix Released
Wishlist
Unassigned

Bug Description

Binary package hint: phatch

Tried to work with 24bpp TIF images (converted from Canon RAW 2 format with UfRaw to 48bpp and with The GIMP to 24bpp). With the "Check images first" checkbox set, all I got was a dialog with a list of all the images that it could not work with, saying they were invalid (no output in the log dialog). Unchecking that option resulted in the following messages in Tools > Show log...:

Error 0: Unable to open file: /home/jeghegy/unsorted/Temp/csevi/valogatott/_MG_1090.tif:
cannot identify image file

Traceback (most recent call last):
  File "/var/lib/python-support/python2.5/phatch/core/api.py", line 234, in get_photo
    photo = pil.Photo(image_file,image_index,save_metadata,folder)
  File "/var/lib/python-support/python2.5/phatch/core/pil.py", line 293, in __init__
    layer = Layer(image_open(filename))
  File "/var/lib/python-support/python2.5/phatch/core/pil.py", line 75, in image_open
    return Image.open(x)
  File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1917, in open
    raise IOError("cannot identify image file")
IOError: cannot identify image file
*

Revision history for this message
Stani (stani) wrote :

Could you please attach such file?

Changed in phatch:
assignee: nobody → stani
status: New → Incomplete
assignee: nobody → stani
status: New → Incomplete
importance: Undecided → Wishlist
Revision history for this message
Bálint Magyar (balintm) wrote :

Can you give me an e-mail address? The files are work-related and I would rather not make any of them public.

Revision history for this message
Bálint Magyar (balintm) wrote :

Sorry, found it on your page. Sending in a minute.

Revision history for this message
Stani (stani) wrote :

Thanks. Could you make an image which might be publicly available? The problem is with the PIL library, so I need to be able to refer to for other developers.

Revision history for this message
shula (zaffix) wrote :

here, this TIFF also produces errors, and it can be public.
here's the error message i'm getting.
needless to say, phatch works well on all other image formats i checked (so far).
------------------------

Error 0: Can not apply action Save on image '0009.tif' in folder:
D:\media\books\herbs.hebrew

decoder group4 not available

Action: {'fields': {'As': u'png',
            'Filename': u'<filename>',
            'In': u'<folder>_phatch/<subfolder>',
            'JPG Quality': u'85',
            'JPG Size Maximum': '0kb',
            'JPG Size Tolerance': '5%',
            'PNG Optimize': u'false',
            'Resolution': u'<dpi>',
            '__enabled__': u'true'},
 'label': 'Save'}

Traceback (most recent call last):
  File "D:\temp\x\phatch\core\api.py", line 277, in apply_action
  File "D:\temp\x\phatch\actions\save.py", line 97, in apply
  File "D:\temp\x\phatch\core\pil.py", line 339, in save
  File "C:\programs\Python\Lib\site-packages\PIL\Image.py", line 1372, in save
    self.load()
  File "C:\programs\Python\Lib\site-packages\PIL\ImageFile.py", line 180, in load
    d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
  File "C:\programs\Python\Lib\site-packages\PIL\Image.py", line 375, in _getdecoder
    raise IOError("decoder %s not available" % decoder_name)
IOError: decoder group4 not available
*
------------------------

Revision history for this message
shula (zaffix) wrote :

i went into Pil a little bit. my version is
Pil 1.1.6
Python 2.5.1
running on windows XP sp2 (as you might've guessed already)

the pil module opens the file, but any operation results in this error, meaning it doesn't have a decoder for this particular version of TIFF, i assume.

which is strange, i guess. it's a standard TIFF.

HTH

------------------------------------------------

Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "C:\programs\Python\Lib\site-packages\PIL\Image.py", line 1372, in save
    self.load()
  File "C:\programs\Python\Lib\site-packages\PIL\ImageFile.py", line 180, in load
    d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
  File "C:\programs\Python\Lib\site-packages\PIL\Image.py", line 375, in _getdecoder
    raise IOError("decoder %s not available" % decoder_name)
IOError: decoder group4 not available

Revision history for this message
Stani (stani) wrote :

@shula: Is this a 24bit tiff? Or just a tiff with group4 encoding? If it is not a 24bit tiff, please file it again as another bug. I might be able to fix group 4 encoding, but no garantuee for now.

Revision history for this message
Bálint Magyar (balintm) wrote :

stani, you can give the image I sent you to any developers that need it for debugging. Just asking you not to make it available to anyone on a public tracker or similar.

Revision history for this message
Stani (stani) wrote : Re: Phatch doesn't support 24bpp & decoder group4 TIF

@Bálint: The development process doesn't work like that. I do not send them private emails, I need to refer them to a public available image. Just shoot a random picture and upload it here.

Revision history for this message
Stani (stani) wrote :

Can someone set the importance of this bug to 'wishlist' on phatch(ubuntu)?

Changed in phatch:
importance: Undecided → Wishlist
Revision history for this message
ironpony (unixdude) wrote :
Revision history for this message
Stani (stani) wrote :

Unfortunately, I can't fix this bug myself. This has to be fixed in the underlying PIL image library.

Changed in phatch:
status: Incomplete → Triaged
Revision history for this message
Stani (stani) wrote :

This bug should be filed against python-imaging.

Changed in phatch (Ubuntu):
assignee: stani → nobody
Changed in phatch:
assignee: stani → nobody
status: Triaged → Won't Fix
affects: phatch (Ubuntu) → python-imaging (Ubuntu)
Changed in python-imaging (Ubuntu):
status: Incomplete → New
Revision history for this message
Stani (stani) wrote :

If I add a dependency libtiff-tools for Phatch, I might use the workaround described in:
http://mail.python.org/pipermail/image-sig/2009-May/005696.html

"you can use "tiffcp -c
none -r -1 %s %s" % (myfilename, tempfilename) to unpack to a
temporary file; this is fairly efficient since PIL can then memory map
the resulting image file. The tiffcp utility is shipped with libtiff.

</F>"

summary: - Phatch doesn't support 24bpp & decoder group4 TIF
+ Phatch doesn't support decoder group4 TIF
Changed in phatch:
assignee: nobody → stani (stani)
status: Won't Fix → Confirmed
Revision history for this message
Stani (stani) wrote :

Good news, I've just implemented read support for any type of tiff file (group4, zip, jpeg, lzw, ...). I could do this by implementing another backend next to PIL for Phatch. For compressed tiff files it will use libtiff-tools, which are also available for other platforms such as Windows. Of course this will introduce a new dependency for Phatch, but I think you don't mind. I'll new try to add write support for tiff compression.

Can some Motu decouple the python-imaging bug from Phatch? Thanks!

$ bzr commit -m "added read support for tiff compressions"
modified phatch/core/pil.py
modified phatch/core/lib/libtiff.py
Committed revision 602.

Changed in phatch:
importance: Wishlist → Medium
status: Confirmed → In Progress
Stani (stani)
Changed in phatch:
importance: Medium → High
Revision history for this message
Stani (stani) wrote :

After some effort, I could add write support as well. Right now this feature is beta, so it will need good testing. So Balint, Fevrin and ironpony I count on you. It seems to handle all files well which were included in this bug report or sent to me.

Changed in phatch:
status: In Progress → Fix Committed
Stani (stani)
Changed in phatch:
milestone: none → 0.2.1
status: Fix Committed → Fix Released
Revision history for this message
ricardisimo (ricardisimo) wrote :

I'm trying to batch rescale a folder of tiff images and getting (maybe) the same error.

"Unable to open file. blahblahblajh
image file is truncated (16 bytes not processed)"

What does this even mean?

Revision history for this message
Thomas Hotz (thotz-deactivatedaccount) wrote :

Marking as fixed release, because we have this new version now in Ubuntu.

ricardisimo: Please file a new bug, if you have still problems.

Thank you very much to all.

Changed in python-imaging (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.