(GRASS Shell Script)

d.out.file uses, the GRASS PNG or PostScript driver, and gdal_translate to export the currently selected X display monitor to a graphics file of several formats. Output image size can be set prior to export.

PNG and PPM formats are supported directly by the GRASS PNG driver and PostScript output is supported directly by the GRASS PS driver.

TIFF, GeoTIFF, JPEG, and BMP formats are supported by using gdal_translate on PPM format files produced by the GRASS PNG driver. Different levels of compression/quality are supported for JPEG files.

Graphic files are exported to the user's current working directory by default, but different paths may be specified in the output field.

EPS files are not compatible with d.frame, as it is not possible to nest encapsulation. Only the first frame will be drawn. In these cases it is recommended to output to regular PostScript format and then use a utility like ps2epsi to convert to an EPS file. Output from this module using the regular PostScript format may contain subframes.

GeoTIFF export is provided as a convenience. For raster export it is generally preferable to use the r.out.gdal or r.out.tiff modules. The advantage of using d.out.file is that you can easily overlay multiple raster maps, vector maps, and decorations into the GeoTIFF at the expense of resolution and quality. If you wish to minimize the negative effects, use "g.region align=" or "g.region rast=", then "g.region -g" or " -g" to discover the raster rows and columns of the map, and feed these numbers into d.out.file's size parameter as columns,rows.


Speafish dataset

  g.region rast=slope -p
  d.mon x0
  d.rast slope
  d.vect streams type=area,line
  d.barscale at=0,94.5
  d.out.file spearfish_pic format=png size=800,600
  d.out.file spearfish_pic format=ps -r paper=a4

Multi-pane PostScript output using a shaded relief map and d.frame.quarter from the Wiki-Addons site

  g.region rast=elevation.dem
  r.shaded.relief map=elevation.dem shad=elev.shad_relf
  d.mon x1
  d.frame uno
  d.his h=elevation.dem i=elev.shad_relf brighten=50
  echo "A" | d.text -b color=black size=10 at=93,5
  d.frame dos
  d.his h=slope i=elev.shad_relf brighten=40
  echo "B" | d.text -b color=black size=10 at=93,5
  d.frame tres
  d.his h=landcover.30m i=elev.shad_relf brighten=55
  echo "C" | d.text -b color=black size=10 at=93,5
  d.frame cuatro
  d.his h=trn.sites i=elev.shad_relf brighten=15
  echo "D" | d.text -b color=black size=10 at=93,5
  d.frame full_screen
  d.out.file spearfish_4 format=ps -r paper=a4


d.frame, d.mon, d.out.png,, g.region,, r.out.gdal, r.out.tiff
Cairo driver, PNG driver, PostScript driver, HTML-map driver, X driver
GDAL Homepage


Michael Barton, Arizona State University
Hamish Bowman, Otago University, New Zealand

Last changed: $Date$