In previous posts we addressed the topic of processing astronomical images using GIMP. This time we will talk about using Photoshop and FITS Liberator.

FITS Liberator v2.3 is a plugin for Photoshop (up to CS4) created by ESA/ESO/NASA.
Varied documentation on the subject can be found on the ESA Hubble Space Telescope page.
In previous posts we alluded to this plugin and the use of Photoshop. We made an introduction and two tutorials, created by the Chandra Observatory's openFITS project.
There we used GIMP and the G'MIC plugin, which are open source, but it was noted that that program has limitations and that for other examples it was necessary to use Adobe Photoshop, although in this case it is not open source.
This time, we will do some examples using Adobe's program and the mentioned plugin and with Hubble images.
The Space Telescope has a fixed number of well-defined filters that can be broadband (wide) or narrow. The former allow a wide range of colors, while the latter restrict more the transmission of radiation from an atomic transition, allowing astronomers to investigate individual processes in the object.
Here we will also use FITS images, whose names will indicate which filter was used. For example, a file named 502nmos.fits indicates that the filter used has a peak at 502 nm. In the table shown below you will see that this filter is a narrowband one.

Basic FITS Liberator
Once installed, the plugin provides a preview window that shows how the imported image will look, with zoom capability and with a dynamic histogram that helps visualize the distribution of data values in the file, updating when processing the image with a stretch function.
For images with low dynamic range, the images can be imported using a simple linear scale, showing brightness in proportion to the data values.
For images with greater range, the image must be processed mathematically using a stretch function to compress the highlights a bit and allow bringing out details in the shadows. This is achieved in several steps. First, the background level is identified and subtracted from the dataset. Then, the peak level of the brightest features of interest are identified and rescaled to a specified value. Finally a stretch function is chosen to rescale the brightness in the image.
The most common stretch function is ArcSinh(x). Once selected, the level of range compression can be changed by adjusting the Scaled Peak Level. For high values it will bring out brightness from the more diffuse features relative to the brighter ones. Usually values from 10 to 100 are recommended.
We will do here a step-by-step as indicated on the Hubble page, using some of the images in the datasets they have for education (and fun).
http://www.spacetelescope.org/projects/fits_liberator/datasets_archives/
1- Get the images
We download the images we like, keeping in mind that this tutorial is for using three exposures.
This time I chose images of the Eagle Nebula.
We will see that on the page there are three exposures (502, 656 and 673) and a composition that contains the three previous ones imported into Photoshop (it's a psd file) and in which each layer was adjusted and colored.
To do the example we would download the three separately and, in any case, later we will download the composition to compare with our result.
2-Liberating the FITS images
a. We open the FITS images one by one.
When doing so we will notice something different from usual. Instead of opening in PS, we are presented with the FITS Liberator interface.
In it we will see the image with the histogram below and some parameters on the side.
Above the image we will see tabs for Metadata, Image Headers and a help.

b. In the histogram we will have the black level on the left with two little arrows to increase or decrease. The same on the right for the white level. We can modify the values to achieve good contrast without too much black and overly saturated areas.
c. We press the Auto Scaling button to set the background and peak levels using the white and black level sliders.
d. We select the ArcSinh(x) function from the side, where it says Stretch function, to bring out the more diffuse details. If the image were very dark, we can increase the value of the Scaled Peak Level to higher values (100, 1000).
If we modify this peak value manually we must then press ENTER or TAB to update.
e. We click OK and repeat the process for the three FITS files.

Now the hard work in Photoshop remains.
3-Combine the different exposures in different layers in the same image
If the layers window is not open, we open it with Windows->Layers or F7.
One way to combine the images into one with different layers is to select one image (Ctrl+a) and copy (Ctrl+c).
We choose another image and paste (Ctrl+v), which will create another layer.
We rename the layers when pasting by double-clicking. For example "656nmos-green".
We repeat with the third image.
We order them in chromatic order: blue (the shortest wavelength), the medium wavelength one second (green) and finally the longest wavelength one (red).
Thus we would have an image with three layers (502blue, 656green and 673red). The other two images we can close without saving changes.
Now we will continue to step 4. There are 9 steps in total. Phew, it's a lot. The following box can ease the process up to step 8 or, we can continue to the next one.
One action is worth more than a thousand
Unless we are very interested in the details, we can easily skip steps 4 to 7 with a Photoshop Action. Actions are sets of instructions, like macros. There is an Action that covers steps 3 to 7 and that we can download from:
http://www.spacetelescope.org/projects/fits_liberator/download/
It is an .atn file that we must save in the PS actions directory, usually c:\program files\Adobe\Photoshop CS\Presets\Photoshop Actions).
We load the action: Window->Actions. We will see a small window with actions predefined by the program. On the right, at the top, we can open a menu where we select Load actions...
Or, in the same menu, we might see the Colour Composite action and we choose it.
We will see that in the Actions window we now have three Colour Composite actions displayed called RED layer, GREEN layer and BLUE layer, that is, one action for each color layer.

We select a layer, for example the 673rojo. We select the RED Layer action and press the Play button (the little triangle) in the actions. If it asks us if we wish to combine we choose NOT to combine.
We do the same with the two remaining layers.
The result, for each of the actions executed on each layer is the creation of another three layers (for each of the previous ones) with Hue/Saturation, Curves and Levels. That is, nine layers will be created with the name Hue/Saturation 1, Curves 1, Levels 1 and the same for the other two layers.
4-Change the mode to RGB
If we decide to try the action, but prefer now to continue with the step-by-step we can press Ctrl-Alt-Z repeatedly to undo all steps until the third one, with the three files as layers of a single image.
Image->Mode->RGB
5-Create an adjustment layer for levels
a. We select a layer and add an adjustment layer:
Layer->New Adjustment Layer->Levels...
The name of the new layer, by default, will be Levels 1 (we can change it to Levels Red, green or blue. We can also leave it as Levels x and choose a color for the layer red, green or blue).
Do not forget to select the option to use previous layer to create clipping mask.
Each time we do this a histogram is shown so we can adjust the image level. (It is recommended to uncheck the Eye icons on the different layers we are not working on to visualize only that one and adjust the histogram properly).
Since a new layer is created it is easy to undo or do this later, as the layer itself is not modified.

6-Curves layers
We will do the same as above but instead of adding a levels adjustment layer, we will do it with Curves. The main strength of this tool is the ability to emphasize or diminish the dark and light parts.
We repeat the process for the three red, green and blue layers.
Again we choose the option Use previous layer...
7-New Hue/Saturation layers
The same. We choose a layer (leaving only that one with the EYE icon)
Layers->New adjustment layer->Hue/Saturation.
The Colorize option MUST be checked.
We adjust with the following values
Hue: Blue 240, Green 120, Red 0.
Saturation: 100
Lightness: -50
7-Making the layers transparent
For each original layer (the exposures), the mode should be "Grain Merge", while in the other layers the mode should be "Normal".
We can play (and spend a lot of time) changing the "Normal" mode for other modes and changing in each case the opacity and fill.

8-Embellishing the cosmos
If when adding the new adjustment layers we didn't make any changes, this is the moment. We can double-click on the graphs that appear to the left of the name of each levels, curves and tones adjustment layer. The configuration of each adjustment will be seen so we can modify it.
9-Cropping the universe
The image can be seen better if we crop it so the edges where there is no image disappear. It is also possible that we want to rotate it.
The cropping tool is easy to use, but we could also go to Image->Crop and choose between Transparent pixels, top left or right pixel color.
10-Saving the work and exporting
If we save the image, File->Save as... it is advisable to use the Photoshop format which will save the file as .psd preserving all layers, so we can later edit them if we wanted.
To save in jpg format we can go to Save for Web and Devices where we can select only a part or shrink the image.
After several attempts my result is:

The following is an image published on the Hubble page of the Pillars of Creation.

On the ESA Hubble Space Telescope page we can download a manual and more documentation on the subject (in English).
Sources and related links
About the images
- Own screenshots using NASA/ESA Hubble images of M16.


