[gdal-dev] Percent stretch 16 to 8-bit geotiff conversion

Brent Fraser bfraser at geoanalytic.com
Wed Sep 7 17:36:24 EDT 2011

Have a look at


Best Regards,
Brent Fraser

On 9/7/2011 2:22 PM, David Shean wrote:
> Forgive me if this is not the proper forum (no gdal-users list?) or if this question has been answered in the past - I've been using GDAL for a while now, but just joined the mailing list and I'm relatively new to python.
> I have large (>2GB uncompressed) UInt16 geotiffs that I need to convert to 8-bit geotiffs.  I'd like to use a percent range (e.g. 0.5-99.5%) to determine the new min/max for the linear stretch in gdal_translate.  I haven't found any simple way of doing this with the existing GDAL utilities, although it looks like gdalenhance was at least initially designed to do something along these lines.
> If there is no simple way to do this with existing tools, is there any sample code floating around that might help?  If not, I know it will be possible with the histogram/stats functions in gdal, numpy, or PIL - I just want to make sure that I'm not reinventing a slower, clunkier wheel.
> Thanks.
> -David
> ---
> David Shean
> Polar Science Center
> Applied Physics Lab
> University of Washington
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

More information about the gdal-dev mailing list