[gdal-dev] Gdal on Linux

Frank Warmerdam warmerdam at p...
Thu Nov 22 09:03:39 EST 2001



Andreane Meunier wrote:

> Band 1 Block=256x4 Type=Int32, ColorInterp=Undefined
> Min=1.000/1, Max=1122.000/-1073743528

...

> And these are my commands:
> ./gdal_translate adf test3
> ./gdal_translate -ot UInt16 adf test4
> 
> When I open them with "The Gimp", test3 doesn't open because it's in 32 
> bits and
> test4 is really bad (I get a black image with only a white line 
> representing a
> river... so when I use a river-less file I get a completely black 
> image!) What
> am I doing wrong?
> 
> Is there a way to visualize 32 bits images? How come all the information is
> gone from the image in UInt16? I'm not very familiar with geographic 
> formats as
> I'm doing this for a computer graphics class at school so any help would be
> appreciated.


Andreane,

It would appear the dynamic range of your image is 1 to 1122. If translated
into a 16bit output file and displayed by a naive application like Gimp, the
values 1-1122 out of a possible value range of 0 to 65535 will all appear
black. What I think you really need to do is scale the image to 8 bit based
on it's dynamic range (ie. mapping 1122 to 255, and 1 to 0 and linear in
between) however, GDAL doesn't have a really convenient way of doing this
from the commandline.

You could use an application that is more savvy about this sort of thing,
such as OpenEV (openev.sf.net) or work out a way of rescaling the data.

If you have python support it would be possible to fairly easily with
a script like this:


import Numeric
import gdal
import gdalnumeric

image = gdalnumeric.LoadFile( "adf" )

image = image * 255 / 1122.0
image = image.astype(Numeric.Unsigned8)
gdalnumeric.SaveArray( image, "out.tif" )

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at p...
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent





More information about the Gdal-dev mailing list