ImageMagick convert TIFF to JPEG reporting `compression not`

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?".
Locked
aleiphoenix
Posts: 3
Joined: 2012-09-24T08:58:22-07:00
Authentication code: 67789

ImageMagick convert TIFF to JPEG reporting `compression not`

Post by aleiphoenix »

Hi, all

I've recently dealing with tiff images using php and imagick. I found a weird tiff image.

Because the RHEL5 Distribution's ImageMagick's somehow outdated for PHP Imagick, so I compiled a IM myself, using 6.7.3-1.

But when I was trying load a tiff file, it complained about

Code: Select all

/tmp/a.tif: Can not read TIFF directory count. `TIFFReadCustomDirectory' @ error/tiff.c/TIFFErrors/505
compression not supported `/tmp/a.tif' @ error/tiff.c/ReadTIFFImage/1035
I've googled much, found this http://www.imagemagick.org/Usage/formats/#tiff saying about
JPEG to TIFF conversion...

convert image.jpg image.tif

This will either save the image inside the TIFF file using JPEG compression
(whcih was inherited from the JPEG input. Or it will error such as...

Error: "JPEG compression support not configured"

This is caused by the TIFF library not including JPEG compression support.

Either way THIS IS BAD.

You can get around this problem by changing the setting to use a different
compression algorithm:

convert image.jpg -compress zip image.tif
convert image.jpg -compress lzw image.tif
convert image.jpg +compress image.tif

WARNING: -compress Group4 with a TIFF works, but ONLY if you remove all
transparent and semi-transparent pixels from the image. Typically you can
make sure this is done the same way as JPEG images above, using
-background {color} -flatten
or -bordercolor {color} -border 0
just before the final save (the first only works for single images).
the compiled IM of mine is built with system's libtiff and libjpeg, so I think this shouldn't me cause any problem?

I would really like to use rather new version of IM (at least 6.6+), so I'm left no choice but compile it by my self. But I have no luck to get rid of this problem.

The file can be found here, http://dl.dropbox.com/u/5976062/sample.tif

Could anyone figure out it for me ?

Thanks!
Last edited by aleiphoenix on 2012-09-24T19:04:56-07:00, edited 1 time in total.

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ImageMagick convert TIFF to JPEG reporting `compression

Post by fmw42 »

I cannot figure out how to download your file. It never shows the download link.

aleiphoenix
Posts: 3
Joined: 2012-09-24T08:58:22-07:00
Authentication code: 67789

Re: ImageMagick convert TIFF to JPEG reporting `compression

Post by aleiphoenix »

I've updated the file url.

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: ImageMagick convert TIFF to JPEG reporting `compression

Post by fmw42 »

What is that you want to do with this tiff? Or was it a problem creating it? If the latter, then provide the input image and command line?

identify -verbose sample.tif

works but does give an error

identify: sample.tif: Can not read TIFF directory count. `TIFFFetchDirectory' @ error/tiff.c/TIFFErrors/562.
identify: sample.tif: Failed to read custom directory at offset 90950736. `TIFFReadCustomDirectory' @ error/tiff.c/TIFFErrors/562.

This works to make the png but does give the same error:

convert sample.tif sample.png

also this works but gives an error

convert sample.tif sample.png


So you may just be getting an error about reading some part of the meta data, which may be malformed.

I tried to remove it by adding -strip, but got the same error.

However, the new png or tif files do not have that error.

aleiphoenix
Posts: 3
Joined: 2012-09-24T08:58:22-07:00
Authentication code: 67789

Re: ImageMagick convert TIFF to JPEG reporting `compression

Post by aleiphoenix »

IM installed on the RHEL server by the rpm works like a charm, didn't give any error. libtiff on the server is 3.8.2

IM on my own gentoo box with 6.7.8.7, can still convert it but give `Can not read TIFF directory count` and `Failed to read custom directory`.

compiled by me own cannot work.

So I suppose this something wrong with the compile configure flag ?

Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: ImageMagick convert TIFF to JPEG reporting `compression

Post by Jason S »

The TIFF file is malformed. It has a bad pointer to Exif metadata.

Code: Select all

$ tiffdump sample.tif
...
34665 (0x8769) LONG (4) 1<90950736>
...
It claims the Exif data starts at byte 90950736, but the file is only 550406 bytes in size.

Locked