pngdriver.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>PNG driver</title>
  5. <meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
  6. <link rel="stylesheet" href="grassdocs.css" type="text/css">
  7. </head>
  8. <body bgColor=white>
  9. <img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade>
  10. <h2>NAME</h2>
  11. <em><b>PNG driver</b></em> - display driver to create PNG, PPM, or BMP images.
  12. <h2>DESCRIPTION</h2>
  13. The PNG driver generates PNG, PPM, or BMP images from GRASS display
  14. commands. Per default PNG files are written with this driver. This
  15. driver is used by default if <em><a href="cairodriver.html">Cairo
  16. driver</a></em> is not available.
  17. <h2>USAGE</h2>
  18. <h3>Environment variables</h3>
  19. The PNG driver can be enabled by setting <b>GRASS_RENDER_IMMEDIATE</b>
  20. variable, eg.
  21. <div class="code"><pre>
  22. export GRASS_RENDER_IMMEDIATE=png
  23. </pre></div>
  24. Several environment variables affect the operation of the PNG driver:
  25. <ul>
  26. <li><b>GRASS_WIDTH=xxx</b><br>
  27. the width of the image map (default is 640).
  28. </li>
  29. <li><b>GRASS_HEIGHT=yyy</b><br>
  30. the height of the image map (default is 480).
  31. </li>
  32. <li><b>GRASS_BACKGROUNDCOLOR=RRGGBB</b><br>
  33. specifies the background color to use in RGB notation (hex or
  34. R:G:B values). Named colors are also supported. Default
  35. is <b>FFFFFF</b> (white).
  36. </li>
  37. <li><b>GRASS_TRANSPARENT=[TRUE|FALSE]</b><br>
  38. sets transparent background on (TRUE) or off (FALSE, default).
  39. </li>
  40. <li><b>GRASS_TRUECOLOR=[TRUE|FALSE]</b><br>
  41. sets true-color support. Default is TRUE.
  42. </li>
  43. <li><b>GRASS_PNGFILE=filename</b><br>
  44. the filename to put the resulting image in, default is <tt>map.png</tt>.
  45. If you set GRASS_PNGFILE to a filename which ends in ".ppm", a PPM
  46. file will be created (with alpha channel stored in a PGM image, if applicable).
  47. If you set GRASS_PNGFILE to a filename which ends in ".bmp", a 32-bpp
  48. BMP file will be created (these are not readable by some older viewers).
  49. </li>
  50. <li><b>GRASS_PNG_COMPRESSION=[0|1|9]</b><br>
  51. compression level of PNG files (0 = none, 1 = fastest, 9 = best, default is 6)
  52. </li>
  53. <li><b>GRASS_PNG_READ</b><br>
  54. if <tt>TRUE</tt>, the PNG driver will initialize the image from
  55. the contents of GRASS_PNGFILE.
  56. </li>
  57. <li><b>GRASS_PNG_MAPPED</b><br>
  58. if <tt>TRUE</tt>, the PNG driver
  59. will map GRASS_PNGFILE as its framebuffer, rather than using
  60. memory. This only works with BMP files.
  61. </li>
  62. </ul>
  63. <h3>Example</h3>
  64. <div class="code"><pre>
  65. export GRASS_RENDER_IMMEDIATE=png
  66. export GRASS_TRUECOLOR=TRUE
  67. g.region rast=elevation
  68. d.rast elevation
  69. d.vect roadsmajor color=red
  70. </pre></div>
  71. This writes a file named <tt>map.png</tt> in your current directory.
  72. <h2>NOTES</h2>
  73. The PNG driver uses the libpng (see
  74. the <a href="http://www.libpng.org/pub/png/">libpng</a> home page) and
  75. zlib (see the
  76. <a href="http://www.zlib.net">zlib</a> home page), all which needs to
  77. be installed for the PNG driver to work (it's worth it).
  78. <p>The resolution of the output images is defined by current region
  79. extents. Use <tt>g.region -p</tt> to get the number of rows and cols
  80. and use the environment variables to set the image size. If you would
  81. like a larger image, multiply both rows and cols by the same whole
  82. number to preserve the aspect ratio.
  83. <p>Further PNG file processing (e.g. quantization to 1 bit for monochrome
  84. images) can be done with <tt>pnmquant</tt> of
  85. the <a href="http://netpbm.sourceforge.net/">netpbm</a> tools.
  86. <h2>SEE ALSO</h2>
  87. <em>
  88. <a href="cairodriver.html">Cairo driver</a>,
  89. <a href="psdriver.html">PS driver</a>,
  90. <a href="htmldriver.html">HTML driver</a>,
  91. <a href="variables.html">variables</a>
  92. <br><br>
  93. <a href="d.rast.html">d.rast</a>,
  94. <a href="d.vect.html">d.vect</a>,
  95. <a href="d.mon.html">d.mon</a>,
  96. <a href="d.erase.html">d.erase</a>,
  97. <a href="d.redraw.html">d.redraw</a>
  98. </em>
  99. <h2>AUTHOR</h2>
  100. Original version: Per Henrik Johansen &lt;<i>phj (at)
  101. norgit.no</i>&gt; <!-- broken link <I><a href="http://www.norgit.no">NORGIT AS</a></i> -->
  102. <br>
  103. Rewritten by: Glynn Clements, 2003
  104. <p><i>Last changed: $Date$</i>