[gdal-dev] nearblack: Warning 1: Band 1 is not of type GDT_Byte. It can lead to unexpected results.

Frank Warmerdam warmerdam at pobox.com
Tue Feb 26 16:31:03 EST 2008


John Mitchell wrote:
> When I run the following command:
> nearblack -near 1 -nb 0 "c:\temp1\w3.tiftemp"
> I get the below warning
> Warning 1: Band 1 is not of type GDT_Byte. It can lead to unexpected 
> results.
> 
> The file now look very much different than the original source NITF, 
> which I guess is what the "unexpected results" message meant.
> 
> I have also attached the gdalinfo of converted nearblack file called 
> 55439_gdalwarp_nearblack.gdalinfo
> 
> When running gdalwarp to convert from NITF to geotiff is their a 
> parameter that would output the file as a geotiff with the band as a 
> type GDT_Byte, so that nearblack would correctly output the geotiff.

John,

Indeed, nearblack will just clamp all values larger than 255 to 255
and write out the result as GDT_Byte.   So this could be quite badly
damaging your 16bit data.

You can add the following arguments to gdal_translate to convert to
byte data type using rescaling: "-scale -ot Byte".

This uses a default scaling algorithm.  You might find it more appropriate
to control the scaling more carefully.

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



More information about the gdal-dev mailing list