[gdal-dev] Force output color interpretation

Asger Sigurd Skovbo Petersen ASP at blominfo.dk
Thu Dec 11 06:01:26 EST 2008


Hi all,

 

I'm having problems with the color interpretation of the output from
GDAL utilities. I have some 4 band (Red, Green, Blue, Near infrared)
rasters. The fourth band is interpreted as "Undefined" by GDAL, but GDAL
insists on marking the fourth band as ALPHA in the output. Having the
fourth band marked as ALPHA causes a bunch of problems with other
software, so I would really like the GDAL tools to leave it as
"Undefined". Is this possible?

 

Please find a simple example below where gdal_translate marks fourth
band as ALPHA.

 

Best regards

Asger

 

Example:

c:\>gdalinfo --version

GDAL 1.6.0dev, FWTools 2.2.6, released 2008/08/22

c:\>gdalinfo 2km.tif

Warning 1: TIFFFetchNormalTag:Incompatible type for "RichTIFFIPTC"; tag
ignored

Driver: GTiff/GeoTIFF

Files: 2km.tif

Size is 10000, 10000

Coordinate System is `'

Origin = (580000.000000000000000,6330000.000000000000000)

Pixel Size = (0.200000000000000,-0.200000000000000)

Metadata:

  TIFFTAG_SOFTWARE=Adobe Photoshop CS4 Windows

  TIFFTAG_DATETIME=2008:12:09 17:27:10

  TIFFTAG_XRESOLUTION=72

  TIFFTAG_YRESOLUTION=72

  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)

Image Structure Metadata:

  INTERLEAVE=PIXEL

Corner Coordinates:

Upper Left  (  580000.000, 6330000.000)

Lower Left  (  580000.000, 6328000.000)

Upper Right (  582000.000, 6330000.000)

Lower Right (  582000.000, 6328000.000)

Center      (  581000.000, 6329000.000)

Band 1 Block=10000x1 Type=Byte, ColorInterp=Red

Band 2 Block=10000x1 Type=Byte, ColorInterp=Green

Band 3 Block=10000x1 Type=Byte, ColorInterp=Blue

Band 4 Block=10000x1 Type=Byte, ColorInterp=Undefined

 

c:\>gdal_translate 2km.tif out.tif

Warning 1: TIFFFetchNormalTag:Incompatible type for "RichTIFFIPTC"; tag
ignored

Input file size is 10000, 10000

0...10...20...30...40...50...60...70...80...90...100 - done.

 

c:\>gdalinfo out.tif

Driver: GTiff/GeoTIFF

Files: out.tif

Size is 10000, 10000

Coordinate System is `'

Origin = (580000.000000000000000,6330000.000000000000000)

Pixel Size = (0.200000000000000,-0.200000000000000)

Metadata:

  TIFFTAG_SOFTWARE=Adobe Photoshop CS4 Windows

  TIFFTAG_DATETIME=2008:12:09 17:27:10

  TIFFTAG_XRESOLUTION=72

  TIFFTAG_YRESOLUTION=72

  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)

Image Structure Metadata:

  INTERLEAVE=PIXEL

Corner Coordinates:

Upper Left  (  580000.000, 6330000.000)

Lower Left  (  580000.000, 6328000.000)

Upper Right (  582000.000, 6330000.000)

Lower Right (  582000.000, 6328000.000)

Center      (  581000.000, 6329000.000)

Band 1 Block=10000x1 Type=Byte, ColorInterp=Red

  Mask Flags: PER_DATASET ALPHA

Band 2 Block=10000x1 Type=Byte, ColorInterp=Green

  Mask Flags: PER_DATASET ALPHA

Band 3 Block=10000x1 Type=Byte, ColorInterp=Blue

  Mask Flags: PER_DATASET ALPHA

Band 4 Block=10000x1 Type=Byte, ColorInterp=Alpha

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20081211/1c91235d/attachment.html


More information about the gdal-dev mailing list