[GRASS-user] Invert values of raster image

Hamish hamish_b at yahoo.com
Mon Feb 23 20:01:19 EST 2009


Wesley wrote:
> 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.

If you are only interested in flipping the colors, and not actually the
data, you might try the r.colors -n flag.

e.g
  r.colors yourmap -n color=grey255


or to really flip values, instead of r.reclass you might try r.mapcalc:
  r.mapcalc "flippedmap = 255 - yourmap"


Hamish



      



More information about the grass-user mailing list