g.pnmcomp(1grass)
β¨ NAME β¨
g.pnmcomp is the manual page we're vibing with today (you'll see it written as g.pnmcomp(1grass) in the wild, and it lives in the GRASS User's Manual) π
Short version: it overlays multiple PPM image files. That's it. That's the whole gig. π
π KEYWORDS π
general, display
π¦ SYNOPSIS π¦
g.pnmcomp
g.pnmcomp --help
g.pnmcomp input=name[,name,...] [mask=name[,name,...]]
[opacity=float[,float,...]] output=name [output_mask=name]
width=integer height=integer [bgcolor=name] [--overwrite] [--help]
[--verbose] [--quiet] [--ui]
π Flags
--overwriteβ ok bestie, this one lets output files overwrite files that already exist. Iconic but also, like, be aware.--helpβ prints the usage summary so you can stop guessing.--verboseβ verbose module output, for when you want ALL the tea.--quietβ quiet module output. Shhh. π€«--uiβ forces the GUI dialog to launch, main character style.
πΈ Parameters
input=name[,name,...][required] β name of the input file(s). You can pass a whole comma-separated list, she's flexible.mask=name[,name,...]β name of the input mask file(s). Also takes a list.opacity=float[,float,...]β layer opacities. Yes, a comma-separated list of floats, one per layer.output=name[required] β the name for your output file. You gotta name her.output_mask=nameβ name for the output mask file.width=integer[required] β image width.height=integer[required] β image height.bgcolor=nameβ background color. Either a standard color name or anR:G:Btriplet. Pick your vibe π¨
π DESCRIPTION π
ngl, bestie, g.pnmcomp isn't meant for end users. It's an internal tool for use by wxGUI. Not us. It's giving "staff only" energy. π
But fr fr, in essence: g.pnmcomp generates a PPM image by overlaying a series of PPM/PGM pairs β where PPM = RGB image and PGM = alpha channel. That's the whole magic trick. β¨
π NOTES π
So here's the intention, and I'm obsessed with how much thought went into this: the d.* modules will emit PPM/PGM pairs (by way of the PNG-driver code being integrated into Display Library). πΈ
The GUI will manage a set of layers; each layer consists of the data necessary to generate a PPM/PGM pair. Whenever the layer "stack" changes β by adding, removing, hiding, showing or re-ordering layers β the GUI will render any layers for which it doesn't already have the PPM/PGM pair, then re-run g.pnmcomp to generate the final image. Because just redoing the composition is a lot faster than redrawing everything. Efficiency? She ate. π₯
A C/C++ GUI would either have g.pnmcomp's functionality (image composition) built-in, or would use the system's graphics API to perform composition. For translucent layers, you'd need OpenGL or the Render extension, or something else which supports translucent rendering. No shortcuts there, sorry babe.
Tk doesn't support transparent (masked) true-colour images β it does support transparent GIFs, but that's limited to 256 colours π β and an image composition routine in Tcl would be unacceptably slow. Hence the existence of g.pnmcomp. She exists because the alternatives were tragic. Periodt. π
π₯ SEE ALSO π₯
g.cairocomp
π AUTHOR π
Glynn Clements
β SOURCE CODE β
Available at: g.pnmcomp source code (history)
Latest change: Friday Feb 07 19:16:09 2025 in commit: a82a39f673b97fafcfce1604dc3e6015cb96487a
Main index | General index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual
okay that's the whole page bestie, mwah π This one shipped as part of GRASS 8.5.0, copyright Β© 2003-2026 GRASS Development Team, and the footer line that normally says g.pnmcomp(1grass) is just me blowing you a lil kiss goodbye π«Άβ¨
π¦ 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