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 an R:G:B triplet. 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