[GRASSLIST:63] Re: d.rgb question

Glynn Clements glynn.clements at virgin.net
Fri May 16 19:18:12 EDT 2003


Russell Nelson wrote:

>  > Using color=gray will map the lowest existing category to black and
>  > the highest existing category to white; if the map doesn't use the
>  > entire 0-255 range, you will get the wrong result.
> 
> Why is this left up to users to set correctly?  Why doesn't importing
> an image do this automatically?

Because r.in.gdal doesn't write a colour table unless the file itself
has a colour table (bear in mind that r.in.gdal isn't just for
images). Or, rather, it didn't in 5.0.2 and earlier; this has recently
been fixed in the CVS HEAD.

Also, GDAL itself goes a bit too far in its abstraction; the caller
just gets a grid of integers, with no way of knowing what the "white"
value should be. The CVS HEAD version guesses, and uses 0-255 for
8-bit unsigned data and 0-65535 for unsigned 16-bit data (i.e. if you
import 4-bit or 12-bit data, you will get a very dark image).

BTW, this was discussed in mid-March on the development list, in the
thread entitled "r.in.gdal updates?".

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list