[Gdal-dev] Create GTiff with 8bit color table
Frank Warmerdam
warmerdam at pobox.com
Tue Sep 11 09:56:46 EDT 2007
Oliver Eichler wrote:
> Hi,
>
> I try to make my first experiences with GDAL. I simply want to create some geotiff file from 8bit color table index data.
>
>
> GDALDriverManager * drvman = GetGDALDriverManager();
> driver = drvman->GetDriverByName("GTiff");
>
> dataset = driver->Create("test.tif",width,height,1,GDT_Byte,0);
> GDALRasterBand * band1 = dataset->GetRasterBand(1);
> band1->SetColorInterpretation(GCI_PaletteIndex);
>
> dataset->FlushCache();
>
> This code will tell me:
> ERROR 6: SetColorInterpretation() not supported for this dataset.
>
> What's my fault during setup?
Oliver,
The GeoTIFF driver does not support setting or resetting the color
interpretation. However, as long as you do it before you start writing
raster data you can use the SetColorTable() method on the band of a
single band file and it will be changed internally to paletted.
> BTW is there any reason why GDALColorTable is not visible in the documentation?
No *good* reason. I have fixed this.
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