[Gdal-dev] resampling 8-bit imagery
Angus Dickey
angusd at midwestsurveys.com
Wed Jun 21 19:38:32 EDT 2006
I have a bunch of 8-bit paletted png images with gcps that I am trying to reproject by following these steps (in a shell script):
- extract the cgps from a text file
- use gdal_translate to copy the png to a geotiff defining the projection and adding the gcps along the way
- using gdalwarp to change the projection and output another geotiff
This actually works great as long as I use nearest neighbour resampling, other resampling methods (e.g. cubic convolution) mess up the resultant image. I assume this is because they change the grey levels of the 8-bit channel and they would no longer map to the palette.
Using nearest neighbour does not produce a very nice image so I tried to use pct2rgb.py before gdal_translate like so:
pct2rgb.py -of GTiff in.png out.tiff
The resultant tiff does not appear to be a standard 3 channel rgb tiff; it will not open in normal image editing software and it causes gdalwarp to error out:
ERROR 5: GDALDataset::GetRasterBand(2) - Illegal band #
ERROR 5: GDALDataset::GetRasterBand(3) - Illegal band #
Am I missing something obvious? Any help would be appreciated.
Thanks,
~Angus
More information about the Gdal-dev
mailing list