|
Create your own Color Hubble Images
Zolt Levay, Office of Public Outreach
Until
recently, making presentable images from Hubble data has been fairly
cumbersome, requiring some experience with specialized software
such as IRAF or IDL, used to analyze astronomy data. Now the process
has been significantly streamlined with the introduction of the
Photoshop FITS Liberator. If you have a basic understanding of astronomical
data, digital photography and a working knowledge of Adobe Photoshop
you can transform astronomical data in the FITS format into pretty
pictures, in black and white or in color. The resulting images may
be used as any digital photo: reproduced in print, displayed on
a web page, emailed, etc.
FITS, the Flexible Image Transport System is a file format used
for many years in astronomy to store and move images from telescope-based
instruments. It has been designed to provide capabilities needed
by astronomers but is not a generally known format such as JPEG
or TIFF.
Adobe Photoshop is the industry-standard “digital darkroom”
software for working with photos. It includes many tools to work
with images to improve tonal range, color, contrast, in addition
to combining multiple exposures, adding annotation, and a whole
suite of more artistic capabilities. But Photoshop has not recognized
FITS data, until now.
The Software
The primary tool in the process is a software plugin to Adobe Photoshop
called the FITS Liberator. This free software was developed by the
European Space Agency (ESA), European Southern Observatory (ESO)
and the National Aeronautics and Space Administration (NASA) and
is available for free download from ESA along with instructions
for the simple installation, sample data, and much more information.
See this
page in our Content Creator’s Toolbox for more information.
The plugin is available for PC/Windows and Mac systems and works
identically on both. It provides full functionality with Photoshop
CS (also known as version 8.0) but it also works with Photoshop
version 7.0 as well as Photoshop Elements versions 3.0 and 2.0,
with more limited functionality.
After installing the plugin, Photoshop recognizes FITS files as
a known, native format. To begin, start Photoshop and open a FITS
image using the File > Open (keyboard shortcut: CTRL/CMD+O).
You will see the FITS Liberator dialog:

The main components of the dialog are:
- The preview window at uper left shows a representation
of the image as it will appear once opened in Photoshop. The image
initially is sized to fit entirely within the window but the "+"
and "-" buttons below may be used to zoom in and out. In
addition, clicking and dragging within the window will pan a zoomed
image.

- A “histogram” below plots the number of pixels
of each data value in the image.

- Sliders and numeric input to specify the range
of data values to import.

- A menu of the available image planes/extensions,
if applicable to the FITS data.
- Image statistics include image size, minimum
and maximum data value, etc. Moving the pointer within the display
window shows the location and value of the pixel at the pointer's
location.

- The “stretch function” specifies how the image
data values should be transformed into pixel values in the Photoshop
document. Selections are: linear, log, square root, sqrt(log)
and log(log).


- Various switches control other functionality:
whether to use 8-bit or 16-bit channels in the Photoshop document,
whether to translate FITS null values to black or transparent
pixels, whether to show the image preview, how to preview out-of-range
pixels, and how to display the histogram.
The Data: Obtaining FITS Images
The FITS Liberator will accept valid FITS data from any source.
Several sample datasets from various sources are available from
the European
Space Agency.
Data from Hubble Space Telescope and several other missions are
available from the Multimission
Archive at Space Telescope (MAST) . Because of the size and
complexity of the archive and the data, only a very brief introduction
will be given here. Various tools are available for searching and
retrieving data from the extensive collections, from a very comprehensive
cross-mission
search, to more directed
search by specific mission, coordinate, instrument, etc., or
more sophisticated searches by pointings
(HST only), scrapbook
, etc. For a limited set of observations, initial processing
has been performed to produce High-Level
Science Products more suitable for display and analysis than
individual datasets.
Once the desired observations are identified, datasets may be retrieved
from the archive, made available via anonymous ftp (alternately,
you may register as an archive user). Complete instructions and
tutorials are online and help is available via email.
Be aware that HST image datasets are quite large, and observation
sets generally include numerous exposures. Be prepared with plenty
of disk space and RAM. A single HST ACS/WFC exposure from the archive
is a 170MB FITS file. A single WFPC2 exposure is 10MB. Many HST
datasets available from MAST can be used as-is. In some cases, "on-the-fly"
processing (OTF) combines associated datasets into a single image.
Others require more extensive processing after retrieval to produce
useable data.
The Process: Making a Black & White Image
The key element in producing presentable images from data is how
to scale the image from the pixel values in the input file into
values in the image that are displayed as a range of gray brightness
levels. This is accomplished by selecting the range of input values
and specifying the function to transform the input data into displayed
pixel values. Astronomical images tend to include a very large range
of brightness levels, from the very dark sky background to much
brighter stars, galaxy nuclei, etc. Often small numbers of pixels
have values well outside the usual range. "Dead" detector elements
or other causes can result in values of zero or much less than the
normal sky background. Cosmic rays can produce much higher counts
than moderately bright stars. Using a data range including the minimum
and maximum data values often does not produce a very exciting image.
Although celestial objects appear very dim in the sky to our eyes,
long exposures with sensitive detectors on large telescopes yield
a large range of numerical values in the resulting images (technically
referred to as large dynamic range, made possible by image formats
with high bit-depth).
Select the function from the “stretch function” menu.


In many cases, log scaling provides the best results for astronomical
images. This conveniently serves to enhance contrast and bring out
details in the darker areas of the image, where the interesting
stuff often goes on in astronomical images. In addition, it suppresses
the much brighter areas such as the centers of stars, where the
detail is not so critical. Sometimes square root (sqrt) stretch
works better for certain types of images. Try different functions
to see which result appears more pleasing in the preview.
FITS Liberator will select an initial data range based on the distribution
of data values, but will most likely not produce the best image.
Adjust the data range using either the sliders under the histogram
plot or the numeric input values labeled “Black level” and “White
level”. You will see the result in the preview display. As you increase
the black level the image will darken overall and whole areas will
become black (clipped). If the “Black clipping” check box is selected
those pixels whose value is smaller than the black level will show
as blue in the preview but will become black in the Photoshop document.
Conversely, as you decrease the white level, the image will brighten
overall and more pixels will become white (saturated). If the “White
clipping” check box is selected the pixels whose value is greater
than the white level will show as green in the preview and will
become white in the Photoshop document. You can experiment with
the data range to achieve a pleasing result.
By paying attention to the out-of-range indicators in the image
preview, it is possible to scale the image such that the background
(shadows, in photo terminology) is dark, but not completely clipped
and the brightest areas (highlights) are not saturated or rendered
totally white.
Select whether to scale the data to 8-bit or 16-bit pixels in Photoshop.
The advantage of using 16-bits/pixel channels is that there are
many more gray levels available. The disadvantage is that it makes
the resulting image files twice as large in disk storage. Having
more gray levels available means that you can adjust the image a
great deal.
When you are satisfied with the result, click “OK” to accept the
image as adjusted and read the image into a black and white (gray)
Photoshop document. Note that there is no provision for automatically
recording the settings, so you may wish to write down the scaling
function and black and white levels. The result will be a gray image
in a Photoshop document window:

Photoshop Adjustments
Once the image is in Photoshop, a vast suite of tools is available
to adjust and manipulate the image. Perhaps the most useful of these
are the “levels” and “curves” adjustments. Levels (Image > Adjustments
> Levels or CTRL/CMD-L) allows you to adjust the brightness and
contrast of the image overall by specifying the minimum data value
to assign black and the maximum data value to assign white (similar
to the black and white levels in the FITS Liberator). In addition,
it permits an intermediate adjustment (sometimes referred to as
“gamma”) that changes the functional transformation between the
pixel values and displayed pixel brightness (something like the
selection of the stretch function in the Liberator but with continuous
variation rather than fixed functions).

Curves (Image > Adjustments > Curves or CTRL/CMD-M) permits
much more flexible changes to the brightness and contrast of the
image with a graphical representation of an arbitrary transform
function.

Note that it is usually preferable to apply adjustments as an
"adjustment layer" rather than modifying the image layer directly.
Create an adjustment layer using Layer > New Adjustment Layer
or the New Adjustment icon on the Layers Palette.
A further refinement is to apply adjustments only to areas that
need it. For example, you can brighten fainter regions without blocking
up (saturating) brighter areas by applying a mask to the adjustment,
if it is applied using an adjustment layer. Paint in the layer mask
with black to prevent the adjustment from applying.
The goal of such adjustments is an image with a more balanced range
of tones, from black to white, making visible those features in
the data that are of most interest. For example, a well-crafted
curves adjustment can enhance relatively faint outer arms of a galaxy
without saturating brighter areas near the nucleus.
Save your work. If you save as a Photoshop document all features
will be available for recovering and modifying again, including
full 16-bit image layers, adjustment layers, masks, etc.
The Next Step: Making a Color Composite
A more sophisticated exercise is to combine multiple exposures
into a color composite. Registered exposures of the same object
made using different color filters may be used to reconstruct a
color image. In general the colors will not be “real” as in what
we would see visually. But the colors do represent actual
physical properties of the subject. The basic idea is to combine
the images using Photoshop's "layers" which permits multiple images
to be combined in a single document. There are various ways to combine
the images; the most flexible is to put the separate images in separate
layers and colorize each. This method permits adjusting the hue
more or less arbitrarily, combining two or more images, and applying
numerous adjustments to each gray image separately.
In this case we will "colorize" the image by applying a different
hue to each layer, making use of the "additive" color model, in
which varying intensities of the primary hues red, green and blue
add together to produce the range of all possible visible colors.
This is accomplished by "projecting" each layer onto the virtual
screen of a displayed image using Photoshop's "Screen layer blend"
mode.
To begin, open each image as a gray Photoshop document using the
FITS Liberator. Copy each to a separate layer by dragging and dropping
each in one of the documents. Note that if you hold down the Shift
key while dropping, the dropped image will be centered in the existing
document. It's best if the images are registered (the features in
all the images line up pixel for pixel) beforehand, which may be
done using external software. However it is possible to register
them manually in Photoshop, but that's a little beyond this exercise.
The Photoshop "Layers Palette" will graphically show the order of
layers in the document.

(Note that you can assign a color and name to each layer using
the "Layer properties". In this case, the name (the text to the
right of each thumbnail) was used to identify the source of each
image. The color has nothing to do with the color applied to the
image pixels but serves only to further label and identify the layer.)
Convert the grayscale document to RGB color: Image > Mode >
RGB Color , select Don't Merge when asked. Set the "layer blend
mode" of each layer to "Screen" using the drop-down menu in the
Layers palette or Layer > Layer Style > Blending Options...:

To colorize each layer use "Hue/Saturation" adjustment, preferably
using an adjustment layer (Layer > New Adjustment Layer >
Hue/Saturation...).

Select the "Hue" of the layer to convert the gray image to a color
layer. The numerical hue values correspond to angles around a color
wheel: 0 is red, 60 is yellow, 120 is green, 108 is cyan, 240 is
blue, 300 is magenta, and intermediate values result in intermediate
colors. Make sure the "Colorize" box is checked, set "Saturation"
to 100 and "Lightness" to -50. This will ensure that the colors
for that layer will range from black (for 0 pixel value) to the
brightest possible value of the given hue (for the maximum pixel
value, 255 for 8-bit channels). Finally, to apply the Hue/Saturation
adjustement only to the appropriate image layer, "Group" the Hue/Saturation
colorize layer with the corresponding pixel layer by highlighting
the adjustment layer and using the menu Layer > Create Clipping
Mask (or CTRL/CMD-G on the keyboard).
 
Note that applying the "additive primaries" red, green and blue
to three layers provides the broadest range of colors in the final
image.You may certainly use any combination of these, but the range
of possibilities is seemingly endless. The values suggested here
result in the most predictable results and the widest range of reproduced
colors. In the example above we have used the colorize values as
described above and have inserted a descriptive Layer Name to make
note of the intent of each.
In general the resulting color composite is not very sastisfying,
appearing dull, or having a particular color cast. Again, you can
apply any of the numerous Photoshop adjustmets to improve brightness,
contrast, color, etc., just as with any digital photo. Adjustments
may be applied to each gray image layer by inserting a Levels, Curves,
etc. adjustment layer between the image layer and its corresponding
Hue/Saturation colorize adjustment layer. In addition, you may adjust
the composite as a whole by inserting adjustment layers above all
of the image and adjustment layers.
 
Again, save your work, and don't forget to save often; you never
know when a system crash or other disaster may strike.
|