[SOLVED] "Can not read TIFF directory count" - IM 6.5.5-2

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Winawer

[SOLVED] "Can not read TIFF directory count" - IM 6.5.5-2

Post by Winawer »

Hello,

I've got a problem that's driving me up the wall. I downloaded and built IM 6.5.5-2 from source on Snow Leopard, and I am trying to process a TIFF file using convert. The TIFF file is a 32-bit colour TIFF which I'm resampling, unsharping, and changing to an 8-bit grayscale image as well as removing the alpha channel with +matte (the full command is convert testimage.tif -resample 600x600 -unsharp 7.4x3.0+3.0+0.0 -colorspace Gray -depth 8 +matte processed.tif, though the exact combination of options has no apparent effect).

About 3 out of every 5 times, I get an error:

Code: Select all

convert: Can not read TIFF directory count. `TIFFFetchDirectory' @ tiff.c/TIFFErrors/336.
convert: Failed to read directory at offset 4292. `TIFFReadDirectory' @ tiff.c/TIFFErrors/336.
convert: missing an image filename `processed.tif' @ convert.c/ConvertImageCommand/2806.
The other ~2 times out of 5, the command works properly and the image is converted. This wouldn't be such a big problem if I wasn't relying on convert as part of a toolchain. I'd be happy to provide any information required to diagnose this problem, if someone has any ideas?

Thanks!
Last edited by Winawer on 2009-09-08T22:44:37-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: "Can not read TIFF directory count" - IM 6.5.5-2 on OSX 10.6

Post by fmw42 »

you might want to post your tiff file so that it can be examined.

also perhaps try using -type grayscale rather than -colorspace gray. see if that produces what you want and more consistently. don't know if this will help or not. seems to make the same result from the rose: image

can you eliminate any of your steps in your command and get the same inconsistent processing, ie. can you find which step causes the inconsistency

you might also want to to upgrade to the latest version of IM although it is only a few versions past what you have.
Winawer

Re: "Can not read TIFF directory count" - IM 6.5.5-2 on OSX 10.6

Post by Winawer »

Thanks for the reply.

First, I did not know that things had advanced a few versions - I just downloaded what I presume is the latest version, 6.5.5-8, and tried it again, getting exactly the same results. Everything I write below this is using the latest version (-8).

Here's the image I was using: Image, though I did try it with different images (I even tried it with the logo -> convert logo: logo.tif and then used the command line I gave in my original post) and got the same problem every time. I also eliminated every option one at a time, with no effect - any combination of operators I tried on a TIFF file produced the same problem.

Any thoughts? My only other thought is that it might be a problem with libtiff, but I can't find anything about that on the InterWebs.
Winawer

Re: "Can not read TIFF directory count" - IM 6.5.5-2 on OSX 10.6

Post by Winawer »

Okay, I guess IM is off the hook! I decided to follow up a little more on the libtiff angle, and went back to recompile with a different version of the libtiff source. I had been using the 4.0.0beta4 libtiff, but when I rolled back to 3.9.1, the problem went away!
Post Reply