[Gdal-dev] resampling 8-bit imagery

Angus Dickey angusd at midwestsurveys.com
Fri Jun 23 14:28:52 EDT 2006


Thanks for the response.

It was the band interleaving that was throwing off my other applications, pixel interleaving works fine. As for the GDAL error I was getting, that must have been my fault (script bug), because it seems to handle the band and pixel interleaved tiffs now (GDAL 1.3.2.0, released 2006/05/02).

~Angus



-----Original Message-----
From: Frank Warmerdam [mailto:warmerdam at pobox.com] 
Sent: June 21, 2006 6:13 PM
To: Angus Dickey
Cc: gdal-dev
Subject: Re: [Gdal-dev] resampling 8-bit imagery


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