[FWTools] Color format conversion during warp

Frank Warmerdam fwarmerdam at gmail.com
Tue May 10 17:46:24 EDT 2005


On 5/10/05, Matthew Harmon <matt at matthewharmon.com> wrote:
> 
> Hi All… sorry if this is better at GDAL… I'm still getting my feet wet. 
> 
> I'm using the fwtools build to reproject some imagery and was wondering if
> the warper also converts color data to the destination format.  I can't seem
> to get it working properly. 
> 
> I'm taking some GeoTiff with 3 16-bit bands (11bits of "real" data per band,
> I think) and I want to convert it to 3 8-bit bands for ultimate use as a
> 24bit DirectX texture.  Do I need to manually convert the image after the
> warp, or is there a better way.  I think I have my destination dataset
> properly formatted and prepared… but maybe that's the problem? 

Matthew, 

My suggestion is that as a step before warping that you scale
the data to 8bit with gdal_translate. 

eg. 
gdal_translate -scale in.tif out.tif

You can also give explicit scaling values to gdal_translate. 

eg. 
gdal_translate -scale 0 2047 0 255 in.tif out.tif

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 FWTools mailing list