[gdal-dev] 16 bit / px / band TIFFs unreadable by ImageMagick, others

Nissim Chudnoff nissim.chudnoff.ctr at metnet.navy.mil
Fri Mar 21 16:27:01 EDT 2008


Hello all,

I've been having odd issues using GeoTIFFs made with GDAL that have 16
bits per band RGB data. These images can be read by some software (GDAL,
OpenEV) but not others (ImageMagick, GeoServer, IrfanView), so I can't
tell if there's some problem with the file such that only GDAL works right
(IIRC, OpenEV uses GDAL) or just that everyone else has crappy support of
such files. Here's the commandline I used to generate the GeoTIFF:

gdal_translate -b 3 -b 2 -b 1 -co PHOTOMETRIC=RGB -co INTERLEAVE=pixel -co
TILED=YES -co COMPRESS=LZW input.ntf area_rgb16.tiff

(input is a NITF with bands arranged as BGR, Uint16)

If I add "-scale -ot Byte" to above command, or use it on the output
GeoTIFF to get a 8-bit TIFF, everything works fine (opens in OpenEV, IV,
GeoServer, ImageMagick). Same results with COMPRESS=LZW and none (I had to
use compress to get the file small enough to upload to the image share
place ;)

Here's the output of 'identify -verbose' (ImageMagick v6):
--- 'identify' output ---
area_rgb16.tiff TIFF 412x359 DirectClass 634kb
Image: area_rgb16.tiff
  Format: TIFF (Tagged Image File Format)
  Geometry: 412x359
  Class: DirectClass
  Type: Palette
  Endianess: MSB
  Colorspace: RGB
  Channel depth:
    Red: 8-bits
    Green: 8-bits
    Blue: 8-bits
  Channel statistics:
    Red:
      Min: 0 (0)
      Max: 3 (0.0117647)
      Mean: 1.65772 (0.00650086)
      Standard deviation: 1.08818 (0.00426738)
    Green:
      Min: 1 (0.00392157)
      Max: 4 (0.0156863)
      Mean: 2.40376 (0.0094265)
      Standard deviation: 1.04632 (0.00410323)
    Blue:
      Min: 1 (0.00392157)
      Max: 2 (0.00784314)
      Mean: 1.54358 (0.00605326)
      Standard deviation: 0.498097 (0.00195332)
  Colors: 10
  Histogram:
     13715: (  257,  257,  257) #010101010101
     30660: (    0,  257,  257) #000001010101
     15844: (  257,  514,  257) #010102020101
         9: (  257,  771,  257) #010103030101
         1: (  257,  771,  514) #010103030202
      2381: (  514,  514,  257) #020202020101
      4899: (  514,  771,  257) #020203030101
     40136: (  514,  771,  514) #020203030202
     21477: (  771,  771,  514) #030303030202
     18786: (  771, 1028,  514) #030304040202
  Rendering-intent: Undefined
  Tile geometry: 256x256+0+0
  Resolution: 72x72
  Units: PixelsPerInch
  Filesize: 634kb
  Interlace: None
--- 'identify' output ---

Oddly enough, v5 of ImageMagick thinks the image has a palette in the
image data:
--- 'identify' output ---
TIFF Directory at offset 0x8
  Image Width: 412 Image Length: 359
  Tile Width: 256 Tile Length: 256
  Bits/Sample: 16
  Sample Format: unsigned integer
  Compression Scheme: LZW
  Photometric Interpretation: RGB color
  Samples/Pixel: 3
  Planar Configuration: single image plane
  Predictor: none 1 (0x1)
Image: area_rgb16.tiff
  Format: TIFF (Tagged Image File Format)
  Geometry: 412x359
  Class: DirectClass
  Type: palette
  Depth: 8 bits-per-pixel component
  Colors: 11

     67936: (    0,    0,    0)    black
      6157: (    0,  257,  257)    #000001010101
      7558: (  257,  257,  257)    #010101010101
      6953: (  257,  514,  257)    #010102020101
         9: (  257,  771,  257)    #010103030101
         1: (  257,  771,  514)    #010103030202
      1010: (  514,  514,  257)    #020202020101
      1535: (  514,  771,  257)    #020203030101
     25944: (  514,  771,  514)    #020203030202
     16837: (  771,  771,  514)    #030303030202
     13968: (  771, 1028,  514)    #030304040202
  Filesize: 633.9k
  Interlace: None
  Background Color: grey100
  Border Color: #DFDFDFDFDFDF
  Matte Color: grey74
  Dispose: Undefined
  Iterations: 0
  Compression: LZW
--- 'identify' output ---

I've tried using -co PROFILE=BASELINE but this seems to in fact make
things worse (ImageMagick can't find any TIFF data).

Has anyone had success using 16 bit RGB GeoTIFFs with GDAL and other
software? Apologies if this issue has been discussed before but I didn't
see anything that looked related on the ML. I've posted the image in
question online at:

http://www.picosphere.com/330.tiff

If anyone has any ideas, or suggestions at what I should look at in the
TIFF itself to figure this out, I'd greatly appreciate it.

Thanks,
-Nissim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4075 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080321/887ea019/smime.bin


More information about the gdal-dev mailing list