[gdal-dev] ColorInterp, Scale, Offset etc VRT to TIFF

Frank Warmerdam warmerdam at pobox.com
Thu Apr 15 12:47:11 EDT 2010


Andrew Brooks wrote:
> Hello
> 
> My first problem is that when I set ColorInterp in a VRT file it works
> (gdal_info reports the colour interpretation for each band) but when I
> convert to GeoTIFF the information is lost (gdal_info shows Undefined
> for all but the first band).  Is that a bug or is tiff not capable of
> representing it?

Andrew,

The TIFF format has a very limited set of photometric interpretation
configurations it supports.  Basically it can be:

   <Option name="PHOTOMETRIC" type="string-select">
     <Value>MINISBLACK</Value>
     <Value>MINISWHITE</Value>
     <Value>PALETTE</Value>
     <Value>RGB</Value>
     <Value>CMYK</Value>
     <Value>YCBCR</Value>
     <Value>CIELAB</Value>
     <Value>ICCLAB</Value>
     <Value>ITULAB</Value>
   </Option>

This means you cannot establish band arrangements other than 1,2,3
to be red, green and blue.   Sorry.

> Also I can't set ColorInterp (or Scale, Offset, NoDataValue) in a VRT
> programmatically using the code as shown in the tutorial:
> 
>  papszOptions = CSLAddNameValue(papszOptions, "subclass", 
> "VRTRawRasterBand");
>  papszOptions = CSLAddNameValue(papszOptions, "SourceFilename", "x.dat");
>  papszOptions = CSLAddNameValue(papszOptions, "ByteOrder", 
> "LSB");        // this WORKS
>  papszOptions = CSLAddNameValue(papszOptions, "ColorInterp", 
> "Red");      // this is IGNORED

You are correct that many items cannot be set as part of the Create()
or CreateCopy() process on the VRT driver from creation options.  But in
most cases you should be able to set these after the fact using the
appropriate methods on the dataset or band.

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    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list