Opened 11 years ago
Closed 11 years ago
#5177 closed defect (invalid)
GDAL seems to interpret first three tiff bands by default as red, green, blue
Reported by: | mlennert | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | ColorInterp |
Cc: |
Description
I have the multispectral bands of a Worldview 2 scene in one .tiff file. gdalinfo gives me:
Band 1 Block=8200x63 Type=UInt16, ColorInterp=Red Band 2 Block=8200x63 Type=UInt16, ColorInterp=Green Band 3 Block=8200x63 Type=UInt16, ColorInterp=Blue Band 4 Block=8200x63 Type=UInt16, ColorInterp=Undefined Band 5 Block=8200x63 Type=UInt16, ColorInterp=Undefined Band 6 Block=8200x63 Type=UInt16, ColorInterp=Undefined Band 7 Block=8200x63 Type=UInt16, ColorInterp=Undefined Band 8 Block=8200x63 Type=UInt16, ColorInterp=Undefined
which is not correct as in this image
1:Coastal 2:Blue 3:Green 4:Yellow 5:Red 6:Red Edge 7:NIR1 8:NIR2
On what basis does GDAL decide the ColorInterp ?
This has the annoying side effect that when using r.in.gdal in GRASS, I get wrong layer names as these are based on ColorInterp.
Change History (2)
follow-up: 2 comment:1 by , 11 years ago
comment:2 by , 11 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Replying to rouault:
GDAL decides the color intrepretation from the value of the TIFFTAG_PHOTOMETRIC. From the above output, the file must have TIFFTAG_PHOTOMETRIC (wrongly) set to PHOTOMETRIC_RGB. So the problem is more on the producer of the file. Anyway don't expect a perfect solution for band color interpretation in GeoTIFF. There's no way in the specification to indicate in a file a color interpretation as the one you would expect.
That's it. tiffinfo gives me:
Photometric Interpretation: RGB color
Ok. Closing this as invalid. Sorry for the noise.
GDAL decides the color intrepretation from the value of the TIFFTAG_PHOTOMETRIC. From the above output, the file must have TIFFTAG_PHOTOMETRIC (wrongly) set to PHOTOMETRIC_RGB. So the problem is more on the producer of the file. Anyway don't expect a perfect solution for band color interpretation in GeoTIFF. There's no way in the specification to indicate in a file a color interpretation as the one you would expect.