Saving Graphics

When you display a graphic, you can save it in the following formats.

.bmp Windows Bitmap
.emf Windows Enhanced Metafile
.eps, .ps Encapsulated PostScript
.gif Graphics Interchange Format
.jpeg, .jpg Joint Photographic Experts Group
.jp2, .j2k, .jpx JPEG2000
.kml Open Geospatial Consortium (OGC) Keyhole Markup Language
.pdf Portable Document Format
.pict Mac PICT
.png Portable Network Graphics
.tif, .tiff Tag Image File Format
  1. Create or display graphic in IDL.
  2. Click the Save button in the toolbar. The Save As dialog appears.
  3. The dialog works differently on different platforms. The extension you add to the file name determines the format.

You can also save programmatically from the IDL command line. The following example displays a bar plot:

x = FINDGEN(41)/10 - 2

gauss = EXP(-x^2)

p = BARPLOT(x, gauss, $

   TITLE='Gaussian Distribution',$

   YRANGE=[0,1.1], / DATA)

 

p.Save, "gaussian.png", BORDER=10, $

   RESOLUTION=300, /TRANSPARENT

Note: The Save method saves the window contents after graphic creation. The file is saved in the current directory unless you specify a directory. The current directory is displayed in the Console toolbar. You can also issue the following command to find the current directory:

CD, current=dir

PRINT, dir

Resources