13863 Rate this article:

Displaying the New James Webb Space Telescope Images in IDL and ENVI


NASA’s James Webb Space Telescope is the largest optical telescope in space, and as space science enthusiasts know, the first images from the Telescope were released to the public on July 12, 2022. What may not be known to many, though, is that some datasets from James Webb are already available to be downloaded by the general public for display and analysis, with more coming online daily.

Space Telescope Science Institute’s MAST website gives anyone with an internet connection the ability to make new discoveries through data downloads. To extract meaningful information from the data, an analysis tool is required. Both IDL® and ENVI® have many such tools that allow us to read, display, and analyze the data, practically from the moment the images and spectral data are acquired in space.

James Webb imagery

The central region of the galaxy known as Messier 74, NGC 628, or the Phantom Galaxy is displayed in false color using data from the James Webb Space Telescope’s Mid-Infrared Instrument (MIRI), acquired in July 2022. Click the above thumbnail to view a higher resolution image.

In this blog, we’ll describe the steps to download and display the dataset shown in the image above. This is meant to be a very simple demonstration of data display only. You are encouraged to learn about the capabilities and limitations of the individual instruments, and to gain a thorough understanding of all the associated metadata, not to mention the subject matter expertise, before attempting scientifically valid data analysis.

The first step is to query the STScI MAST site for relevant data. No login is required to query and download data. However, to take advantage of some more advanced features such as notifications, you may wish to create a free account on the MyST service.

Under “Select a collection…” choose “JWST Instrument Keywords”, then in the “Instrument” list, select “MIRI”, the Mid-Infrared Instrument, which is an instrument that collects images versus spectral data. (Link: More information about MIRi can be found here.


Select "Advanced Search".

advanced search jwt

There are many options in the JWST Advanced Search dialog, but in this case we’ll simply scroll down to the “targname” or “Target Name” Filter. If you have a favorite galaxy, nova, binary star, planet, etc., this is where you would locate the current list of captured data. This list will grow exponentially in the coming weeks, months, and years so check back often!

Here, I’ve expanded the list, scrolled to, and selected “NGC 628”.

JWST Advanced Search

In the upper left corner of the JWST Advanced Search dialog, click the “Search” button to retrieve the list of available data. In the “productLevel” Filter on the left-hand side of the search page, select “3”, which requests the data that has been radiometrically corrected, coregistered, with bad pixels corrected, etc.

In this example, I’ve selected just three image bands, jw02107-o039_t018_miri_f1000w_i2d.fits, jw02107-o039_t018_miri_f1130w_i2d.fits, and jw02107-o039_t018_miri_f2100w_i2d.fits, items 1, 3, and 5 in the table.

James Webb imagery

Note: If you select a different dataset and find that there are icons for a “lock” in the table of images, that indicates that the data are “under embargo” and will not be made public until a later time. The science investigators associated with those acquisitions were awarded time on the telescope through a competitive proposal process and have exclusive use of those datasets until then.

Select the “Basket” icon on the search tab’s toolbar.

James Webb imagery

In the following “Download Manager” dialog, select the “JWST” item in the “Files” table and click the “Download” button in the upper right.

James Webb imagery

Select your favorite download format in the following dialog and click the “Download”.

James Webb imagery

You now have fresh-off-the-satellite JWST image data on your local computer. Uncompress the the archive and save the files where they can be accessed from IDL or ENVI. Next, you will need the NASA Goddard Space Flight Center’s IDL Astronomy User’s Library. Download and add this library to your IDL or ENVI search path using whichever techinque you prefer. Reading each FITS-format image into a floating point array is then as simple as:


		IDL> fits_read, dialog_pickfile(), f1000w



Here I’ve used a variable name corresponding the the wavelength band of image jw02107-o039_t018_miri_f1000w_i2d.fits. The area of interest of the galaxy is in the lower left corner of the image, which includes some extra captures (presumably for background processing). A quick command to display the result from this one band is:


		IDL> image(25 > f100w[700:1900, 20:1000] > 55)


James Webb imagery

Because the image data is from the infrared part of the spectrum, you are technically free to “colorize” the data to highlight your regions of interest as you feel appropriate, without any concern that you must represent what the human eye would see. You may be interested in the spiral arms, the central core of the galaxy, or the dust lanes, for example.

To display the data in ENVI, you may wish to combine the three FITS image bands into a single image file that ENVI can read directly. Assuming I have read the other two downloaded files into the variables f1130w and f2100w, to create a (floating point) TIFF image use:


IDL> f = fltarr(3, 5648, 2092)
IDL> f[0, *, *] = f1000w
IDL> f[1, *, *] = f1130w
IDL> f2, *, *] = f2100w
IDL> write_tiff, 'ngc628.tif', reverse(f, 3),/float


We use the IDL “REVERSE” function here to flip the data in Y. The orientation of TIFF file is inverted relative to the default IDL array order. Next, open ENVI and simply import the TIFF file.

From here, you have access to all of ENVI’s built-in image processing tools such as data stretching and the ability to change the band order. And as a more compelling use case, you can now use ENVI’s more powerful data classification and analysis tools like ENVI Deep Learning to make novel discoveries in the data.


Jim Pendleton is a Professional Services Engineer at NV5 Geospatial and former employee of the Space Telescope Science Institute.