[Gdal-dev] Dealing with a GeoTiff with incorrect band ColorInterp values

Frank Warmerdam warmerdam at pobox.com
Thu May 10 10:12:32 EDT 2007


Ben Greene wrote:
> ERROR 5: GDALDataset::GetRasterBand(2) - Illegal band #
> 
>  
> 
> ERROR 5: GDALDataset::GetRasterBand(3) - Illegal band #
> 
>  
> 
> ERROR 5: panDstBands[1] = 2 ... out of range for dataset.
> 
>  
> 
> I don’t want my program to modify the original image, just in case RGB 
> isn’t the correct interpretation, and don’t want to have to copy the 
> image, fix the ColorInterp values, and then warp it to create a third copy.

Ben,

My understanding is that the core problem is that you are using gdalwarp
and it is failing.  Is that right?  If so, could you provide the gdalinfo
report on the input file, and the exact commandline for gdalwarp that
you are using?

 > Is there an option to force RGB interpretation of bands in a Tiff?  Or
 > do I have to correct the ColorInterp values?

When creating a new TIFF or GeoTIFF file you should be able to use the
PHOTOMETRIC=RGB creation option to force the output file to be marked
as RGB.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list