2004.01.03 23:17 "[Tiff] Resampled TIFF doesn't open in viewer", by Pushkar Pradhan

2004.01.03 23:17 "[Tiff] Resampled TIFF doesn't open in viewer", by Pushkar Pradhan

Hi,

I resample a TIFF image (striped, 8 bits/sample, separate image planes, 1 band, width: 621, height: 577, rows/strip 13) by a factor of 2 using Nearest Neighbor method. Thus image width and height increase by 2. Moreover, I make the o/p format IEEE FP.

However, my viewer is unable to open the image (reports it's own errors). I correctly set the rows/strip tag to 26 as it is 13 in the input image. I don't think I have to worry about stripbytecounts and stripoffsets as they cannot be set. But do I need to read these tags from the input image and use it somehow?

Below I've pasted some information that may help in debugging.

This is the information reported by tiffinfo and tiffdump for the i/p image:

TIFF Directory at offset 0x577b6
  Image Width: 621 Image Length: 577
  Resolution: 1, 1 (unitless)
  Bits/Sample: 8
  Sample Format: unsigned integer
  Compression Scheme: None
  Photometric Interpretation: min-is-black
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 1
  Rows/Strip: 13
  Planar Configuration: separate image planes
  Software: IMAGINE TIFF Support Copyright 1991 - 1999 by ERDAS, Inc. All Rights Reserved @(#)$RCSfile: etif.c $ $Revision: 1.9.2.2 $ $Date: 2002/01/14 13:57:53EST $

Magic: 0x4949 <little-endian> Version: 0x2a
Directory 0: offset 358326 (0x577b6) next 0 (0)
ImageWidth (256) SHORT (3) 1 <621>
ImageLength (257) SHORT (3) 1 <577>
BitsPerSample (258) SHORT (3) 1 <8>
Compression (259) SHORT (3) 1 <1>
Photometric (262) SHORT (3) 1 <1>
StripOffsets (273) LONG (4) 45 <8 8081 16154 24227 32300 40373 48446 56519 64592 72665 80738 88811 96884 104957 113030 121103 129176 137249 145322 153395 161468 169541 177614 185687 ...>
Orientation (274) SHORT (3) 1 <1>
SamplesPerPixel (277) SHORT (3) 1 <1>
RowsPerStrip (278) SHORT (3) 1 <13>
StripByteCounts (279) LONG (4) 45 <8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 8073 ...>
XResolution (282) RATIONAL (5) 1 <>
YResolution (283) RATIONAL (5) 1 <>
PlanarConfig (284) SHORT (3) 1 <2>
ResolutionUnit (296) SHORT (3) 1 <1>
Software (305) ASCII (2) 154 <IMAGINE TIFF Support\nCop ...>
SampleFormat (339) SHORT (3) 1 <1>

This is the information reported by tiffinfo and tiffdump for the o/p image:

TIFF Directory at offset 0x76424
  Image Width: 1242 Image Length: 1154
  Bits/Sample: 32
  Sample Format: IEEE floating point
  Compression Scheme: None
  Photometric Interpretation: min-is-black
  Samples/Pixel: 1
  Rows/Strip: 26
  Planar Configuration: separate image planes

Magic: 0x4949 <little-endian> Version: 0x2a
Directory 0: offset 484388 (0x76424) next 0 (0)
ImageWidth (256) SHORT (3) 1 <1242>
ImageLength (257) SHORT (3) 1 <1154>
BitsPerSample (258) SHORT (3) 1 <32>
Compression (259) SHORT (3) 1 <1>
Photometric (262) SHORT (3) 1 <1>
StripOffsets (273) LONG (4) 45 <8 32300 64592 96884 129176 161468 193760 226052 258344 290636 322928 355220 387512 419804 452096 0 0 0 0 0 0 0 0 0 ...>
SamplesPerPixel (277) SHORT (3) 1 <1>
RowsPerStrip (278) SHORT (3) 1 <26>
StripByteCounts (279) LONG (4) 45 <32292 32292 32292 32292 32292 32292 32292 32292 32292 32292 32292 32292 32292 32292 32292 0 0 0 0 0 0 0 0 0 ...>
PlanarConfig (284) SHORT (3) 1 <2>
SampleFormat (339) SHORT (3) 1 <3>

Pushkar