How can I make a color composite image using Spitzer and/or other data?

From CoolWiki
Jump to: navigation, search


Don't forget to try and answer the "Questions to think about ..." at the bottom of this page!


Scientists examine images taken at different wavelengths because different elements and compounds absorb and emit light at different wavelengths.

The Spitzer Space Telescope takes images at several wavelengths, with different cameras. For example, Spitzer took three separate images of M81: one recording IR radiation at 24 microns, one image at 8 microns and one at 3.6 microns. Keep in mind that shorter wavelengths (3.6 microns) represent areas with higher temperatures and longer wavelengths (24 microns) show areas of cooler temperature.

24 um
8 um
3.6 um

Note that the MIPS camera can take images at 24, 70 and 160 microns. The IRAC camera can take images at 3.6, 4.5, 5.8 and 8.0 microns. Here, only 3 wavelengths are shown, 24, 8 and 3.6 microns.

Notice the distinct differences seen in the object at different wavelengths. Also notice that the scientists have chosen to use color to represent the different wavelengths, but all of these wavelengths are much too long for human eyes to see. So scientists record these 'invisible' wavelengths and then use a computer to create images that are visible to us. Here, red indicates longer (cooler) wavelengths and blue represents shorter (hotter) wavelengths. This type of image is called a False Color or Representative Color image, meaning that the colors only represent wavelengths, and aren’t actually color as the human eye would see.

Scientists also use computer graphics programs to combine all of the images into one picture. Here, you can practice this layering technique. You will need a computer with an Internet connection and a graphics program such as Adobe Photoshop or MaxIm DL. Once the three layers are combined, together you get something that looks like this:

M81 3color.png

Here is a movie that shows how an optical image from Hubble is combined with an infrared Spitzer image to create a visible-IR composite image.


First, find data you'd like to use. You need at least three images, preferably at least one of which is Spitzer data just because we are who we are here, but really any three bands will work. See the downloading data page and/or Finding data at other wavelengths. If you can't think of a good object, try any Messier object. They're pretty much all in there.

Next, find a program you can use to combine the images. You may have a program in mind from your prior experience (such as MaxIm DL). But, you can also use a professional astronomy tool called "ds9." ds9 is free free and available for any platform. There is also a free program called "FITS liberator" that used to be a plugin for Adobe Photoshop but is now a standalone program. (Google "FITS liberator" to find the download page and instructions).

Conventionally, the longest wavelength of your stack should be red, and the shortest should be blue. You don't have to do it that way, however.

With real astronomical data, the FITS images (wondering what a FITS file is?) are generally going to be at least 16 bits deep, or in other words there are 216 levels of intensity in the image. Something like a gif is only 8 bits deep, or 28 levels. What this means is that your gif or jpeg will NOT look the same as your FITS image in your image manipulation program -- a FITS image has 16 shades of grey (or shades of color for each color of red, green, and blue), and a gif or jpeg has only 8. You will therefore have to experiment with stretches of the FITS images in order to see all the subtleties of color, and work with the details of how you want to save it to a gif or jpeg. All of this is literally an art, and you should (will have to) play around to find a stretch that shows whatever features of the data you wish to emphasize. There are many web resources with tips and tricks of how to do this, some of which are listed at the bottom of this page -- if you find more, please let us know so that we can link them in.

Using ds9

ds9 ( is an astronomical image manipulation program. ds9 is available for a wide variety of platforms, including unix, and it's free. Most astronomers use ds9 or similar programs. ds9 is a pretty powerful program and has some basic analysis tools included.

The syntax from a linux or unix machine is simply:

ds9 file.fits

From a Mac or Windows machine, double-click on the application to load it. To load an image, click on "File" (the pulldown menu or the button about a third of the way down the screen), then click "open" and load the image.

To load a 3-color image, FIRST click on Frame, then "new rgb", then you will get a pop-up window with the red/green/blue layers indicated. Pick the color you want to load. Then choose file/open and load the image. To load another layer, pick another color to load, and then file/open again.

In any case, you will have to adjust the stretch. To change this, click on Scale then "hist equ" (try other stretches too).

You can zoom in or out.

You can also stack up a bunch of greyscale images, line them up, and blink through them. Click on regular "new" (not "new rgb") and do file/open. Repeat as necessary to load all the images in. Click on Zoom/align wcs. Click on Frame/blink to blink them.

'Align wcs' puts north up. Drag the blue box around in the zoomed out view at the top to change what you see in the main window. Zoom in or out, then choose "align wcs" again before blinking.

If you don't like the color table, Color/more/ one of the options there (try them).

Using MaxIm DL

MaxIm DL is an image processing program that allows you to measure the position of an object (RA/DEC), scroll through multiple images to look for differences & similarities, make tri-color images and much more. NB: The instructions here date from maybe 2005(?) -- see Using MaxIm DL for more recent instructions, including videos.

To determine the Right Ascension and Declination of an object, import an image:

  1. Go to View on the tool bar, and select "Information Window". The information window pops up on the right.
  2. Look at the mode setting in the window, scroll down and set it for astrometric.
  3. Move the cursor around on the image, and notice the information changing in the window. You will get the x,y for the cursor, and the x,y for the centroid. The centroid is just the center of the object you are on. Below the x,y in each case you will have RA and DEC.
  4. The magnitude of the object also shows up to the right of the centroid RA/DEC, but the image may have to be calibrated. We are still working on that.

Aligning images in MaxIm DL:

  1. Open three images. Go to Process on the toolbar. Scroll down and select align.
  2. In the pop – up window select the files to be aligned and select ok.
  3. A new align image popup window will appear.
  4. In the window, select manual 2 star for the Align Mode.
  5. Identify 2 easy to remember reference stars in the image, then center on the first reference star in the 1st image and click, then center on the same star in the 2nd image and click; repeat for the 3rd image.
  6. Repeat the process centering on the 2nd star in each of the images. Then press ok.
  7. Now go to View on the toolbar, scroll down to animate, select add all, press ok.
  8. You can control the speed of the animation in the pop-up window. Experiment with various speed settings.
  9. You can also manually “blink” through the images by using the forward or backward arrows.
  10. To make tri-color images in MaxIm DL you will have to align the images. Follow the instructions for making tri-color images, assigning blue to the shortest wavelength, red to the longest wavelength and green to the middle wavelength.
  11. Before you click ok, select the align button in the upper right of the box. Follow the steps above for aligning the images (use the manual 2 star align mode). Press ok, and when the Combine Color box pops up again, press ok one more time.

Exercise: Layering images of different wavelengths together

  1. Get online and go to the Sky View Virtual Observatory ( and click “Basic Interface” link.
  2. At this website you can select an object and look at it from many different wavelengths. We’re specifically interested in Infrared, so find the IR box. For our practice, we will use data from the 2MASS survey, and download FITS images at J, H, and K wavelengths. (FYI: The J wavelength is 1.25 microns, the H wavelength is 1.65 microns, and K is 2.17 microns.)
  3. For the Sky Coordinates or Object box, type in the coordinates or the name of your object. For example: type in M 51.
  4. Scroll down to the Infrared Surveys and select 2MASS J.
  5. Scroll down to Optional Parameters, and change image size to what ever you want. The value you enter is in degrees, so start off with a small value of 0.3. If you go to big it will take a long time to retrieve the image. (Don’t bother changing any of the other boxes.)
  6. Go to the Bottom of the page and hit the submit button.
  7. Underneath the image that pops up in the new image window, click on the FITS button, and download the fits file. Save the image as M51J. Do this for the other two wavelengths (H and K).
  8. You now have three images at different wavelengths. Go into MaxIm DL (or whatever other program you want) and open the J, H, and K band images.
  9. You want to create an RGB image, assigning the J band as blue, the H band as green, and the K band as red. To do this in MaxIm DL, select "color" from the menu, and drop down and select combine color. The combine color box will pop up. Select RGB conversion type, and assign J band as blue, the H band as green, and the K band as red. Click OK, and the image will pop up.
  10. If you would like to modify the strength of one of the color layers in MaxIm DL, go to Color and select Color Adjust. By clicking on any of the color images (try clicking Red a few times), you will increase the red levels in your image. Click Original to return to your original image and try a different color, or more than one color.
  11. In MaxIm DL, select save file as, and select for file filter "jpeg". Save it. Congratulations! You’ve just made a layered 3-wavelength image.

Questions to think about and things to try with making color images

  • How does the number of stars differ across the bands? Which band has the most stars? The fewest? (Bonus question: why?) The most nebulosity? The least? (Bonus question: why?) Are there more stars in the regions of nebulosity, or less? Why?
  • Create a three-color mosaic using ds9 or your own image processing program. Which bands would you choose? Why? What happens when you include a MIPS-24 mosaic in as one of the three colors with IRAC as the other two? Do the stars match up? Does the resolution matter? Can you tell from just a glance at the three-color mosaic which stars are bright at MIPS wavelengths?
  • Which features are found across multiple wavelengths, beyond the Spitzer regime? Why?
  • Obtain IRAS images from the web (via Spot or other methods) and line them up with the Spitzer images of comparable wavelengths (e.g., 8 um with 12 um, 25 um with 24 um, 60 um with 70 um, and 100 um with 160 um). How much more detail do you see with Spitzer that was missed by IRAS? Do you see more texture in the nebulosity? More point sources?
  • How big is anything in the image you're looking at? (If you're working with IC 2118, for example, how big is the nebula?) (What do I mean by big?) in pixels, arcseconds, parsecs, and/or light years? (Hint: you probably need a distance to the object. If it helps, there are 3.26 light years in a parsec.)
  • Which objects in your image have already been identified in the literature? (For example, if working on IC 2118, which stars in these images are the ones identified by Kun et al. in the literature?) Which ones are totally new objects that no one until you has cared about before?

Come up with your own mosaics and your own answers to these questions and then post your images and discuss your answers in discuss making 3-color images.

I'm ready to move on to more "advanced" color composite imaging techniques.

Useful links

Personal tools