GrADS Image Output

## Producing Hardcopy and Image Output from GrADS

### Generating Image Files from GrADS

There are several GrADS commands that will convert the contents of the graphics window into an image file. The differences between them are the image formats they support and the way they are implemented in GrADS.

printim

The `printim` command was introduced in version 1.8. It produces a PNG, GIF, or JPG formatted image file based on the current contents of the GrADS metabuffer, which is the stuff displayed in the graphics window, minus any widgets. `printim` will work in batch mode.

outxwd

The `outxwd` command draws the contents of the graphics display window to a file in XWD (X window dump) format. It does not work in batch mode.

wi

The `wi` command was deprecated long ago and is not included in version 1.9 or later.

### Generating GrADS metafiles

1. Set-up the GrADS metafile

The first step in creating hardcopy image output is to invoke the `enable print` command -- this opens the output file`` and enables GrADS to direct image information to that file. If the file exists, it will be overwritten.

2. Display the image

The next step is to display the graphic that you want to print. When you have finished, issue the `print`command. GrADS copies the vector instructions used to create the current display into the output file in a GrADS metacode format. For multiple images in your metafile, use `clear`, create the new image, and then `print` again.

3. Close the GrADS metafile

There are three way to close the output file:
`disable print`
`reinit`
`quit`

### Converting GrADS Metafiles to Postscript

GrADS metacode files may be translated into postscript using the GrADS external utilities `gxps` and `gxeps`. Both utilities will prompt for input and output filenames, unless they are provided on the command line. The input filename should be the file created by the `enable print` command. The output filename can be anything, but a ".ps" extension is conventional. Any existing file with this name will be overwritten. Once the output file is created, you may print it using UNIX print commands. Please consult the references pages for `gxps` and `gxeps` to see all the command line arguments and options.

`gxps` and `gxeps` are not GrADS commands. They must be executed from the UNIX command line, or preceded by a `!` and executed as a shell command from the GrADS command line.

### Generating Postscript from within GrADS

There is a shortcut for creating an encapsulated postscript (EPS) file directly from within a GrADS session: use the `print` command without invoking the `enable print` command first. This shortcut allows the user to skip the steps of creating the GrADS metafile and invoking the external utility `gxeps`. However, using this shortcut means there can only be one image per file, and none of the options available when invoking `gxeps` directly can be used.

### Displaying GrADS Metafiles

GrADS metacode files may be displayed using the GrADS external utility `gxtran`. The input filename should be the file created by the `enable print` command. If the GrADS metafile contains more than one image, `gxtran` will animate them. The animation can be automatic or controlled by the user with carriage returns. Please consult the gxtran reference page to see all the command line arguments and options.

### Displaying GrADS Metafiles with Windows 95/NT

The GrADS metafile Viewer (GV) allows you to view and manipulate GrADS graphics output files using Windows 95/NT. There are two files to download:

- gv32.exe
- gv32.hlp

To open the metafile simply double click on a file listed in the File Manager or Explorer, drag and drop the file onto GV, or use the standard Open dialog box. GV assumes that default extension of GRADS metafiles is GMF. If your file includes more than one picture you can browse through pages using the keyboard keys (PageDown and PageUp) or the toolbar buttons.

Use the View commands and the View/Options dialog box to customize the image -- display it as black-and-white or color, change the line thickness, or clip and enlarge any part of the image. Use the right mouse button to access the most commonly used features.

There are two ways to save separate pages of a GRADS metafile as Windows Metafile (WMF): 1) use the File/Save Page As command, or 2) use the Edit/Copy command to copy the current page to the Windows Clipboard and then Edit/Paste it in your favorite Windows application that handles Windows Metafiles.

Use File/Print command to print a current document to any printer (you do not need a Postscript printer). Use File/Print Preview to display the active metafile as it would appear when printed.