[Gdal-dev] sample scaling
Alan Stewart
astewart at TerraGoTech.com
Mon Oct 30 14:09:08 EST 2006
Thanks for the response, Frank.
I didn't know about the -mm flag for gdalinfo. However, it does reveal
the sample values as lying in the 0-2047 range. I was using Global
Mapper, but OpenEV has the same issue. I also have been provided a JPEG
overview; the overview color balance matches the display of the 16 bit
per sample image.
In looking more closely at tiffinfo output, I see one difference other
than the expected change in bits per sample. The 16 bit per sample image
has a Photometric Interpretation of "min-is-black" and has an Extra
Samples tag not present in the 8 bit per sample image. The 8 bit per
sample image has a Photometric Interpretation of "RGB color".
Frank Warmerdam wrote:
> Alan Stewart wrote:
>> 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,
>
> Your understanding of how things should work sound right. I don't know
> why the results are bad. How are you checking the results? What viewer
> did you use with the -scale 0 2047 0 65536 output tiff that looked good?
>
> You might want to view your image in OpenEV, and inspect various pixels
> to make sure that the dynamic range info of 02047 is accurate. Or
> use "gdalinfo -mm your.ntf" to actually scan the data for min and max
> values.
>
> Best regards,
--
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