1pngdriver(1) Grass User's Manual pngdriver(1)
2
3
4
6 PNG driver - driver to create PNG and PPM images
7 (drivers)
8
10 The PNG driver generates PNG and PPM images from GRASS display com‐
11 mands. Per default PNG files are written with this driver. It is
12 started as 'pseudo' monitor (image file instead) and when stopped, all
13 output from previously used display commands are written to the PNG
14 image file.
15
17 Environment variables
18 Several environment variables effect the operation of the PNG driver.
19 GRASS_WIDTH=xxx
20 the width of the image map (default is 640).
21 GRASS_HEIGHT=yyy
22 the height of the image map (default is 480).
23 GRASS_PNGFILE=filename
24 the filename to put the resulting image in, default is map.png.
25 If you set GRASS_PNGFILE to a filename which ends in ".ppm", a
26 PPM file will be created.
27
28 GRASS_BACKGROUNDCOLOR=RRGGBB
29 specifies the background color to use in RGB notation (hex val‐
30 ues). Default is 000000 (black).
31 GRASS_TRANSPARENT=[TRUE|FALSE]
32 sets transparent background on (TRUE) or off (FALSE, default).
33 GRASS_TRUECOLOR=[TRUE|FALSE]
34 sets true-color support
35 GRASS_PNG_COMPRESSION=[0|1|9]
36 compression level of PNG files (0 = none, 1 = fastest, 9 = best,
37 default is 6)
38 GRASS_PNG_AUTO_WRITE=[TRUE|FALSE]
39 if set to "TRUE", the image file will be written after each
40 operation (i.e. whenever a client disconnects), rather than only
41 being written out when the driver terminates.
42 GRASS_PNG_READ
43 if "TRUE", the PNG driver will initialize the image from the
44 contents of $GRASS_PNGFILE.
45 GRASS_PNG_MAPPED
46 if "TRUE", the PNG driver will map $GRASS_PNGFILE as its frame‐
47 buffer, rather than using memory. This only works with BMP
48 files.
49 GRASS_RENDER_IMMEDIATE=[TRUE|FALSE]
50 tells the raster library to use its built-in PNG driver rather
51 than connecting to an external monitor process using sockets. If
52 "TRUE", there is no need to run "d.mon start=PNG"
53
54 Example
55
56 export GRASS_RENDER_IMMEDIATE=TRUE
57 export GRASS_TRUECOLOR=TRUE
58
59 d.mon start=PNG
60 Display raster map and vector polygons
61
62 d.rast somerastermap
63 d.vect somevectormap color=red
64 Stop the driver subsequently. This will write a file named map.png to
65 be created in your current directory:
66 d.mon stop=PNG
67
68
70 The PNG driver uses the libpng (see the libpng home page) and zlib (see
71 the info-zip home page), all which needs to be installed for the PNG
72 driver to work (it's worth it).
73
74 The resolution of the PNG raster map is defined by the map extents. Use
75 g.region -p to get the number of rows and cols and use the environment
76 variables to set the PNG size. If you would like a larger image, multi‐
77 ply both rows and cols by the same whole number to preserve the aspect
78 ratio.
79
80 Further PNG file processing (e.g. quantization to 1 bit for monochrome
81 images) can be done with 'pnmquant' of the netpbm tools.
82
84 HTML map driver, PostScript driver, XDRIVER
85 d.frame, d.mon, d.rast, d.vect
86
88 Original version:
89 Per Henrik Johansen
90
91 NORGIT AS
92
93 Rewritten by Glynn Clements, 2003
94
95 Last changed: $Date: 2007-09-01 19:40:57 +0200 (Sat, 01 Sep 2007) $
96
97 Full index
98
99 © 2003-2008 GRASS Development Team
100
101
102
103GRASS 6.3.0 pngdriver(1)