[Gdal-dev] resampling 8-bit imagery

Frank Warmerdam warmerdam at pobox.com
Wed Jun 21 20:12:41 EDT 2006


Angus,

Indeed, nearest neighbour resampling is usually the only appropriate
resampling to use with paletted images.

Angus Dickey wrote:
> 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.

I don't see an obvious reason the file would not work with gdalwarp.
But many non-GDAL applications do not work very well with band interleaved
TIFF files, so the creation option INTERLEAVE=PIXEL can be helpful.
Unfortunately, it does not seem that the pct2rgb.py script supports
creation options, so you would be stuck doing something like:

   pct2rgb.py in.png out.tif
   gdal_translate -co INTERLEAVE=PIXEL out.tif out_pixel.tif

However, since you are getting errors from gdalwarp it would seem there
is something more serious at play.  What build of GDAL are you using?
Can you provide the in.png and out.tiff for inspection?  Perhaps you could
try the same process with FWTools?

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 OSGF, http://osgeo.org




More information about the Gdal-dev mailing list