GRASS logo

Note: A new GRASS GIS stable version has been released: GRASS GIS 7. Go directly to the new manual page here


d.out.file - Saves the contents of the active display monitor to a graphics file.


display, export


d.out.file help
d.out.file [-btcrm] output=string format=string [resolution=integer] [size=width,height] [compression=integer] [quality=integer] [paper=string] [ps_level=integer] [createopt=string] [metaopt=string] [--verbose] [--quiet]


Set background color to black (white default)
Set transparent background
Use the Cario driver to render images
Set paper orientation to landscape (for PostScript output)
Do not crop away margins
Verbose module output
Quiet module output


Name for output file (do NOT add extension)
Graphics file format
Options: png,ppm,tif,geotiff,jpg,bmp,ps,eps,svg,pdf
Default: png
Dimensions of output file versus current window size
(same=1, double size=2, quadruple size=4)
Default: 1
Width and height of output image (overrides resolution setting)
Compression for PNG files
(0=none, 1=fastest, 9=most; lossless, only time vs. filesize)
Options: 0-9
Default: 9
File size/quality for JPEG files
(10=smallest/worst, 100=largest/best)
Options: 10-100
Default: 75
Paper size for PostScript output
Options: a4,a3,a2,a1,a0,us-letter,us-legal,us-tabloid
Default: a4
PostScript level (only limits functionality!)
Options: 1-3
Default: 2
GeoTIFF creation option(s)
In the form of "NAME=VALUE", separate multiple entries with a comma.
GeoTIFF metadata key(s) and value(s) to add
In the form of "META-TAG=VALUE", separate multiple entries with a comma.


(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: 2011-11-08 03:29:50 -0800 (Tue, 08 Nov 2011) $

Main index - display index - Full index

© 2003-2016 GRASS Development Team