TIFF and LibTiff Mail List Archive


2005.05.18 18:17 "[Tiff] Looking for the definitions of (MS Specific?) tags", by Kevin Grover
2005.05.23 11:33 "Re: [Tiff] (MS Specific?) tags, Hi Kevin", by Ulf Zibis
2005.05.24 09:08 "Re: [Tiff] (MS Specific?) tags, Hi Kevin", by Joris
2005.05.31 23:56 "Re: [Tiff] hot to detect corrupt tif file", by Andy Cave
2005.05.31 19:41 "[Tiff] hot to detect corrupt tif file", by Gordon Hu
2005.06.01 00:02 "Re: [Tiff] hot to detect corrupt tif file", by Bob Friesenhahn

2005.05.31 23:56 "Re: [Tiff] hot to detect corrupt tif file", by Andy Cave

Hi Gordon.

Two things that 'work':

  1. Do a basic open on the tiff file. If that succeeds, you've got a good chance it's a tiff file.
  2. Read the band/tile offsets & sizes, and check that 'they make sense' - that is that each band/tile offsets & offset+size lies within the physical size of the file (assuming it's a file). If the file is corrupt, there is a good chance that this will fail.

After that, the only thing you can do to check there is no corruption, is to read each band/tile (and decompress it et al). But that's a lot of overhead.

So, I'd suggest the first 2. We do that with our product FirstPROOF, and it seems to be a reasonable catch of corrupt files.


Andy Cave,
Chief Executive Officer,
Hamillroad Software Limited.

----- Original Message -----
From: "Bruno LEDOUX" <>
To: <>
Sent: Wednesday, June 01, 2005 12:46 AM

Subject: Re: [Tiff] hot to detect corrupt tif file

> Hi Gordon,
> Not sure exactly what you mean by "corrupt tiff file".

> If you want to check that the CONTENT of a TIFF file hasn't been altered, > you will have to use an external CRC method like MD5 as there is no such

> thing as a checksum in the TIFF format.
> If you want to determine the file format, you can use
> TIFFOpen("file_to_check","r"). If it returns NULL it means the file is NOT
> a

> TIFF file. If you want to perform more detailed checks it going to be more > complex considering the number of different tag formats.

> HTH,
> Bruno.
>> Hi,

>> We are trying to find a way to check a tif file and find out whether >> or not it is a corrupt tif file. Any idea I can do that with libtiff

>> libraries?
>> Thanks, Gordon