pngdriver(1)
π PNG DISPLAY DRIVER π
okay bestie, gather round, because this is pngdriver(1) from the GRASS GIS User's Manual and it's genuinely one of the cutest little drivers in the whole toolkit, no cap β¨
PNG display driver to create PNG, PPM, or BMP images. π
πΈ DESCRIPTION πΈ
So basically? The PNG driver takes your GRASS display commands and turns them into PNG, PPM, or BMP images. It's giving "I make pictures out of your map commands" energy. π¦
Per default, PNG files are written with this driver. And here's the tea: this driver is used by default if the Cairo driver is not available. So if Cairo ghosted you, PNG driver is your ride-or-die. π
β¨ USAGE β¨
π§ Environment variables
You can enable the PNG driver by setting the GRASS_RENDER_IMMEDIATE variable, like, eg:
export GRASS_RENDER_IMMEDIATE=png
Several environment variables affect the operation of the PNG driver, and you're gonna want to know all of them, fr fr:
GRASS_RENDER_WIDTH=xxxβ the width of the image map (default is640). πGRASS_RENDER_HEIGHT=yyyβ the height of the image map (default is480). πGRASS_RENDER_BACKGROUNDCOLOR=RRGGBBβ specifies the background color to use in RGB notation (hex orR:G:Bvalues). Named colors are also supported. Default isFFFFFF(white). π€GRASS_RENDER_TRANSPARENT=[TRUE|FALSE]β sets transparent background on (TRUE) or off (FALSE, default). π«₯GRASS_RENDER_TRUECOLOR=[TRUE|FALSE]β sets true-color support. Default isTRUE. πGRASS_RENDER_FILE=filenameβ the filename to put the resulting image in, default ismap.png. If you setGRASS_RENDER_FILEto a filename which ends in".ppm", a PPM file will be created (with alpha channel stored in a PGM image, if applicable). If you setGRASS_RENDER_FILEto a filename which ends in".bmp", a 32-bpp BMP file will be created (these are not readable by some older viewers). πGRASS_RENDER_FILE_COMPRESSION=[0|1|9]β compression level of PNG files (0= none,1= fastest,9= best, default is6). ποΈGRASS_RENDER_FILE_READβ ifTRUE, the PNG driver will initialize the image from the contents ofGRASS_RENDER_FILE. πGRASS_RENDER_FILE_MAPPEDβ ifTRUE, the PNG driver will mapGRASS_RENDER_FILEas its framebuffer, rather than using memory. This only works with BMP files. β οΈ (BMP only, bestie, don't try it with anything else.)
π Example
export GRASS_RENDER_IMMEDIATE=png
export GRASS_RENDER_TRUECOLOR=TRUE
g.region raster=elevation
d.rast elevation
d.vect roadsmajor color=red
This writes a file named map.png in your current directory. Slay. π
β¨
π NOTES π
The PNG driver uses the libpng (see the libpng home page) and zlib (see the zlib home page), all which needs to be installed for the PNG driver to work (it's worth it). π«Ά
The resolution of the output images is defined by current region extents. Use g.region -p to get the number of rows and cols and use the environment variables to set the image size. If you would like a larger image, multiply both rows and cols by the same whole number to preserve the aspect ratio. Don't skip that part, or your map is gonna look stretched and we do not want that energy. π
Further PNG file processing (e.g. quantization to 1 bit for monochrome images) can be done with pnmquant of the netpbm tools. πΌοΈ
π SEE ALSO π
- Cairo driver
- PS driver
- HTML driver
- variables
d.rastd.vectd.mond.erased.redraw
π AUTHORS π
- Original version: Per Henrik Johansen
<phj (at) norgit.no> - Rewritten by: Glynn Clements, 2003
π SOURCE CODE π
Available at: PNG DISPLAY DRIVER source code (history)
Accessed: Saturday Jan 17 05:39:54 2026
Main index | Topics index | Keywords index | Graphical index | Full index
okay that's the whole page, you ate that π so here's the cute little sign-off: this is GRASS 8.4.2, the GRASS GIS 8.4.2 Reference Manual, Β© 2003-2025 GRASS Development Team, accessed Saturday Jan 17 05:39:54 2026, and yeah β pngdriver(1), periodt. πβ¨
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· 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