Graphics > Graphics Gallery > Images > Viewing an Image

# Viewing an Image

You can quickly open image files to view within the IDL Workbench. Follow the steps below, and use the referenced material below for the next steps you might want to take after viewing the image.

## Steps to viewing an image

Viewing an image in IDL is a simple process that you can accomplish from the command line or from the IDL Workbench menu.

To display an image in IDL, you can use one of the following methods.

## Open an image from the command line

The following command names a variable (dataFilePath) that will contain the image data specified with the FILEPATH command. FILEPATH tells IDL where the data is located. The IMAGE function tells IDL to display the dataFilePath variable.

dataFilePath = FILEPATH('marsglobe.jpg', $

SUBDIR=['examples','data'])

im = IMAGE(dataFilePath)

Alternatively, use the following syntax to locate and open an image that lies in your current path:

myImage = IMAGE(FILE_WHICH('marsglobe.jpg'))

## Open an image from the menu

1. Select File > Open from the IDL Workbench menu and browse to the examples/data subdirectory of your IDL installation.

2. Select the file rose.jpg and click Open. The image is displayed in IDL.

## Resources

- Change graphics properties
- Multiple graphics in one window
- Save a graphic
- Displaying surfaces
- Display a surface with contour lines
- IMAGE
- IDL Graphics Functions
- Formatting IDL Graphics Symbols and Lines
- FILE_WHICH