AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2002.03.22 14:28 "TIFF image tiles from the UK Ordnance Survey Errors out.", by Roger Bedell
2002.03.22 16:05 "Re: TIFF image tiles from the UK Ordnance Survey Errors out.", by Phillip Crews
2002.03.22 17:12 "RE: TIFF image tiles from the UK Ordnance Survey Errors out.", by Roger Bedell
2002.03.22 17:25 "RE: TIFF image tiles from the UK Ordnance Survey Errors out.", by Phillip Crews
2002.03.22 17:46 "RE: TIFF image tiles from the UK Ordnance Survey Errors out.", by Roger Bedell
2002.03.22 16:46 "RE: TIFF image tiles from the UK Ordnance Survey Errors out.", by Laurence R Moore
2002.03.22 17:18 "RE: TIFF image tiles from the UK Ordnance Survey Errors out.", by Roger Bedell
2002.03.22 17:07 "Re: TIFF image tiles from the UK Ordnance Survey Errors out.", by Jason Summers
2002.03.22 22:31 "Re: TIFF image tiles from the UK Ordnance Survey Errors out.", by Chris Cox
2002.03.25 20:13 "UK Ordnance Survey Maps were fixed in 1999", by Roger Bedell

2002.03.22 16:05 "Re: TIFF image tiles from the UK Ordnance Survey Errors out.", by Phillip Crews

Roger,

I've seen bogus TIFF files like these before. I believe they will require two changes to read them:

1. Disable STRIPCHOP support (#define STRIPCHOP_DEFAULT 0 in tiffconf.h, or open using mode "rc").

2. Modify tif_dumpmode.c as follows to calculate the correct length of the strip:

*** d:\libtiff\tif_dumpmode.c   Wed Oct 17 16:44:12 2001
--- d:\temp\tif_dumpmode.c      Fri Jan 28 10:08:10 2000
***************
*** 71,91 ****
   static int
   DumpModeDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
   {
-       TIFFDirectory* td = &tif->tif_dir;
         (void) s;
         if (tif->tif_rawcc < cc) {
!               if ( td->td_planarconfig == PLANARCONFIG_CONTIG
!                && (td->td_rowsperstrip == (uint32)-1 ||
td->td_rowsperstrip == td->td_imagelength) ) {
!                       TIFFWarning(tif->tif_name,
!                               "DumpModeDecode: Invalid strip length (%d),
calculating",
!                                       tif->tif_rawcc);
!                       cc = tif->tif_rawcc = min(cc,
(tsize_t)(TIFFGetFileSize(tif) - td->td_stripoffset[0]));
!               } else {
!                       TIFFWarning(tif->tif_name,
!                               "DumpModeDecode: Not enough data for
scanline %d",
!                               tif->tif_row);
!                       cc = tif->tif_rawcc;
!               }
         }
         /*
          * Avoid copy if client has setup raw
--- 71,82 ----
   static int
   DumpModeDecode(TIFF* tif, tidata_t buf, tsize_t cc, tsample_t s)
   {
         (void) s;
         if (tif->tif_rawcc < cc) {
!               TIFFError(tif->tif_name,
!                   "DumpModeDecode: Not enough data for scanline %d",
!                   tif->tif_row);
!               return (0);
         }
         /*
          * Avoid copy if client has setup raw
--

Note: This diff also makes "not enough data for scanline" a warning rather than an error.

I was able to load your sample in my program (ThumbsPlus), which incorporates these changes.

Kind regards,
Phillip Crews