[GRASS-user] Invert values of raster image

Moritz Lennert mlennert at club.worldonline.be
Mon Feb 23 06:01:22 EST 2009


On 23/02/09 11:16, Wesley Roberts wrote:
> Dear list.
> 
> I have a raster file with values coded in 8 bit grey scale 0-255. I
> would like to invert the raster values so that 255 is now 0 and 0 is
> now 255. I have not found an out of the box solution in grass but
> have tried the r.reclass function. 

How about r.recode with a rule such as:

old_low:old_high:new_low:new_high
0:255:255:0

?

> I generated a reclass rule file
> but am not sure about the form of the file. 

You need a '=', so

0=255
1=254
etc

Moritz


More information about the grass-user mailing list