r.out.ppm(1grass)
β¨ r.out.ppm β¨
okay bestie, gather round, because this is the GRASS User's Manual page for r.out.ppm and it's literally the glow-up station for your raster maps π
turning them into PPM image files so they can go be cute somewhere else.
πΈ KEYWORDS πΈ
raster, export, output
π SYNOPSIS π
r.out.ppm
r.out.ppm --help
r.out.ppm [-gh] input=name [output=name] [--overwrite] [--help]
[--verbose] [--quiet] [--ui]
π¦ Flags (the lil switches, iykyk)
-gβ bestie this is greyscale mode, no color allowed, we're going monochrome β¨ outputs greyscale instead of color-hβ suppresses printing of the PPM header. shhh. no header. π--overwriteβ lets your output files overwrite existing files, so yes it will absolutely just eat the old one, that's on you π«Ά--helpβ prints the usage summary, the classic "wait what do I do" button--verboseβ verbose module output, it will simply tell you everything--quietβ quiet module output, it will tell you not a single thing π€«--uiβ forces the GUI dialog to launch, main character energy for your mouse
π Parameters
input=name[required] β the name of the input raster map. mandatory. non-negotiable. no input no output periodtoutput=nameβ the name for the new PPM file (and yes, you can use'-'for stdout) Default:<rasterfilename>.ppm
π DESCRIPTION π
So r.out.ppm converts a GRASS raster map into a PPM image at the pixel resolution of the CURRENTLY DEFINED REGION. like, the region you've got set right now, not the map's own vibe. so if you want the resolution and region settings of the raster map itself, run this first:
g.region -p raster=[mapname]
...and then run r.out.ppm. order matters, bestie.
By default the PPM file it creates is 24-bit color, rawbits storage. gorgeous. iconic. but you can use the -g flag to force r.out.ppm to output an 8-bit greyscale instead. and the greyscale conversion uses the NTSC conversion:
Y = .30*Red + .59*Green + .11*Blue
One pixel is written for each cell value, so if ew_res and ns_res differ, the aspect ratio of the resulting image will be off. like it'll be stretched. not a bug, just math being math π
π NOTES π
A few ppm file comments are written: the name of the GRASS raster map, resolution, etc. and like, these are perfectly legal, truly nothing wrong with them, but the author has found one PD image utility that chokes on them π so if you need a commentless PPM file, use 'out=- > outfile.ppm'. and when you're sending output to stdout, no comments are written. so there. clean output, no drama.
lowkey important: comments out = stdout only. that's the trick.
π₯ HINTS π₯
You can create a PNG image with NULL values represented by a transparent background by using the PNG driver with GRASS_RENDER_TRANSPARENT set to TRUE. that's one route π§
Alternatively, you can use the pnmtopng program from netpbm to do this:
r.out.ppm raster
pnmtopng -transparent white raster.ppm > raster.png
two lines, transparent background, slay π
π SEE ALSO π
d.out.file, r.out.ascii, r.out.gdal, r.out.mpeg, r.out.png, r.out.ppm3
π AUTHOR π
Bill Brown, UIUC
β SOURCE CODE β
Available at: r.out.ppm source code (history)
Latest change: Wednesday Jul 02 11:43:06 2025 in commit: 78b88bc34582428809d4a98ae07e2500953f7333
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
and that's the whole page bestie π«Ά thanks for reading this far, you're literally the moment. this was r.out.ppm(1grass) from the GRASS 8.5.0 Reference Manual, Β© 2003-2026 GRASS Development Team, running on GRASS 8.5.0. go export something cute and take care of yourself πβ¨π
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms