[gdal-dev] use scale in gdal_translate
Frank Warmerdam
warmerdam at pobox.com
Mon Feb 25 12:26:50 EST 2008
Limei Ran wrote:
> Hi:
>
> I used the following command to scale a image file:
> gdal_translate landcover14.img -scale 0 127 0 0 -OF HFA out.img
>
> I thought all pixel values in out.img should be 0. But, when I use
> gdalinfo out.img, I saw the same information as those in the original
> image, such as:
> =======================
> .....
> Band 1 Block=64x64 Type=Byte, ColorInterp=Palette
> Description = Layer_1
> Min=11.000 Max=127.000
> Minimum=11.000, Maximum=127.000, Mean=100.336, StdDev=38.292
> Metadata:
> STATISTICS_MINIMUM=11
> STATISTICS_MAXIMUM=127
> STATISTICS_MEAN=100.3361000425
> STATISTICS_MEDIAN=127
> STATISTICS_MODE=127
> STATISTICS_STDDEV=38.292430309159
> STATISTICS_HISTONUMBINS=256
> STATISTICS_HISTOMIN=0
> STATISTICS_HISTOMAX=255
> ......
> ===============================
>
> I thought min and max should be 0 after scaling. Could you tell me
> whether there is any problem?
Limei,
Unfortunately the statistics metadata is getting carried over and the
metadata copying doesn't recognise that the actual pixel data has changed.
Depending on what you actually want to preserve, you could try copying
to a .png file, then removing any .aux.xml that might be created for that
png file, and then copying back to .img format.
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