[Gdal-dev] sample scaling

Alan Stewart astewart at TerraGoTech.com
Mon Oct 30 10:05:39 EST 2006


I've got NITF files that have three bands @ 16 bits per sample. I need 
to produce a GeoTIFF with 8-bit samples, JPEG compressed. In my first 
attempts the resulting image appeared black. I discovered a GDAL 
metadata item. "NITF_USE00A_DYNAMIC_RANGE=02047", which I take it means 
that sample values range from 0 to 2047. If I use "-scale 0 2047 0 
65535" the resulting TIFF looks fine, but if I use "-scale 0 2047 0 255 
-ot Byte" the image is much darker and greenish. I thought this would 
just rescale the sample values to fit in the range 0-255 and create a 
TIFF with 8-bit samples. I didn't expect the color balance of the image 
to change. Is "Byte" actually a signed value or something? If so, how do 
I get an unsigned 8-bit sample?

-- 

Alan Stewart
Senior Software Architect
TerraGo Technologies, Inc.
astewart at TerraGoTech.com
678-391-9700 x9615

"TerraGo Technologies’ GeoPDF is proving to be the smart choice for key players in the intelligence community."
	- Amy Stankiewicz, Editor-in-Chief, Geospatial Solutions




More information about the Gdal-dev mailing list