Producing Hardcopy and Image Output from GrADS

Generating Image Files from GrADS

There are two different 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 is newer and will only work with GrADS version 1.8.

wi

The wi command dumps an exact copy of the GrADS graphics window directly to an image file. It supports a large variety of image formats: GIF, BMP, CGM, EPX, FAX, ICO, JPEG, PCS, HDF, and many others. wi requires an active connection to an X-server -- it will not work in batch mode. Consult the reference page for details.

printim

The printim command produces a PNG or GIF 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. Consult the reference page for details.

Generating GrADS metafiles

1. Set-up the GrADS metafile

The first step in creating hardcopy image output is to enter the command:

enable print filename

This opens the output file filename and enables GrADS to direct image information to that file. Any existing contents of filenamewill be lost.

2. Display the image

The next step is to display the graphic that you want to print. When you have finished, enter the command:

print

GrADS copies the vector instructions used to create the current display into the output file in a GrADS metacode format.

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.

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:

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.