Modern image processing software like Photoshop has become an invaluable tool to anyone seeking to impove the quality
of their digital images - whetever the subject matter.  A good working knowledge of the program can turn a so-so image (or
a group of them) into something you'll be proud of, especially when it comes to astrophotography and the influx of lower
priced Digital SLR's, introductory CCD cameras, and webcams in recent years.  It takes time to master the program,
though, and I admit that I am still learning new tricks and techniques with every new image I work on, but a few simple steps
can help out anyone who is just starting out with some good raw images.

For this tutorial, I will use the raw frames of the M13 image that I took from my house on the night of July 5, 2004.  Click on any of the
images to see them full size
. Most of the steps will have a corresponding image - hopefully making it easier to understand what is
going on.  I use Photoshop version 7.0, but as far as I know, these steps will work in somewhat older versions as well as with Photoshop
Elements - which comes packaged with the Canon Digital Rebel.

1.  First, open up a raw file in Photoshop, which can be an uncompressed file like a .bmp or .tif file or a compresed .jpeg file.  This is a
single 20 second exposure of M13 through my SN6 at ISO 1600, scaled down to 1/3 its size and saved as a compessed .jpeg file.  The
uncompressed, full-size (3072x2048).tif file is 18MB in size,  while a .jpeg of the same image takes up about 3 MB.  As you can see,
light pollution is a major factor in imaging from my house - as even a 20 second exposure leaves the sky a dirty brownish color.  With
Photoshop, though, it is possible to correct this problem, but first you need to stack the raw images into a composite frame in order to
avoid having to remove the light polution from each individual frame seperately. (
Image 1)

2.  By using filter like Curves, you could now make this image much brighter while lessening the brightness of the background, but there
is a big problem with a single frame image - Noise.  Noise manifests itself as bright, random pixels as well as rough transitions between
colors and brightness levels in adjacent pixels (where there should be smoother transitions).  Any image at a high ISO sensitivity (like 800
or 1600, and most low-end CCD cameras like the Sac7 or Sac8 will exhibit a lot of noise at this stage, especially if you zoom in.  This is
where stacking multiple frames becomes so important.

3.  Simply put, stacking several images increases an image's Signal (good info) to Noise (bad) ratio by increasing your total exposure
time faster than the total amount of noise increases.  Signal increases in a linear fasion (1, 2, 3...) while noise only increases by the square
root of the number of frames you are stacking 1, 1.414, 1.732.  For 4 frames, you will have 2x the signal to noise ratio of a single frame
(4 S / 2 N = 2 S/N) Noise tends to be  random, while stars and nebulosity will remain in roughly the same place from frame to frame if
your scope's tracking is good enough.  Go to Layer -> Flatten Image to combine the two layers of your image into one (which will retain
the look of the blended frames).  Do this with all of the frames you plan on using for your final image  (if you save them after removing the
LP gradients, be sure and choose a new file name, in case you make a mistake with the composite frame).  Copy and paste frame #2
onto frame #1 ( in a new layer) and change the blending from Normal to Lighten. This will show the stars in both frames simultaneously,
and unless your tracking is perfect, the two frames will be misaligned somewhat, like the example shown to the right. (
Image 2)

4.  Use the Move tool (upper right on the tools menu - looks like a big arrow and a small cross with arrows at the ends) to move the
second layer until it exactly matches the one below it.  You will probably have to zoom in (Ctrl +, zoom out is Ctrl -) to 2-400% or so
(the number is at the top of the image window) in order to get the pixels to line up properly.  This is the same image with the frames lined
up. (
Image 3)

5.  In order to blend the two images so that the noise will average out, switch the aligned second layer's blending mode back from
Lighten to Normal, and where it says Opacity (meaning how opaque or transparent that layer is) set the slider to 50%.  This means that
the image shown on your screen is half first frame and half second frame - a perfect average.  Zoom in on an area of interest on your
image, and click the "eye" icon beside the second layer on and off.  See a difference?  Even just two frames blended together can make a
huge difference in the smoothness of an image.

6.  To stack more layers, follow steps 3-5 again, but set the opacity for each layer (#N) to 1/N %.  3rd layer: set to 1/3 or 33%, 4th
layer: set to 25%, 5th: 20% and so on until you have aligned and blended all of your layers  The image at right shows the difference
between a single layer with some filtering (I used Image -> Adjustments -> Auto Color, which is a fairly harsh filter and not often used in
processing astrophotos, but it works for this demonstration) versus just 5 layers stacked with the exact same filtering applied.  Notice
how much smoother and less noisy the right image is.  (Both images have been enlarged by about 80%, so they both look less sharp than
they would at normal size, 100%). (
Image 4)

7.  The processed composite image is much smoother than the processed single image, but the only way to process the entire stack at
once (at least in Photoshop 7) is to combine them all into one frame.  Just like in the first part of Step 7, go to Layer -> Flatten Image,
and watch as you are left with one smooth image in place of all of the noisier ones.

Once you have a single, flattened imag, it's a good idea to save your progress in a new file (I would use "M13-<the date I took the
image>" for the title.) Next, you will want to remove the light pollution.  For city skies, the "Light Pollution Gradient Subtraction"
technique is often a quick way to get rid of >Most< (not all) of the light pollution problem.  It's not perfect, but it can help a lot -
especially with small, bright targets like clusters and some nebulae and galaxies. The following technique is also listed in more thorough
detail in Ron Wodaski's book
The New CCD Astronomy, which I highly recommend.

8.  Make sure the History and Layers windows are open (under the Window tab at the top) and off to one side.  Then either go to
Select -> All or push Ctrl+A to select the entire canvas.  Go to Edit -> Copy (or Ctrl+C) and then Edit -> Paste (Ctrl+V) to paste an
exact copy of the original image in a seperate layer.  The second layer is totally opaque at this point, so you are actually not seeing the
first layer at all now, but you will change this later.

9.  Go to Filter -> Noise -> Dust and Scratches and set the slider to 15-30 pixels until most of the stars disappear.  This blurs out the
top layer and removes most of the parts of the image you want to keep, leaving just a diffuse glow where the brightest and / or largest
objects in the image are (usually this will be your target)  Here is M13 with the top layer blurred in this way (
Image 5).

10.  Use the Clone Stamp tool to blend the bright spot in with the background.  This tool copies a round part of your image (whatever
size brush you set) when you hold down the Alt key and pastes it when you click the mouse button.  It looks like a stamp and is located
just above the eraser tool.  I set the brush to soft at 400 pixels on the original file (a bit wider than the glow), pressed Alt just to the right
of the glow, and pressed the mouse button twice to blend the glow away.  The resulting frame is to the right. (
Image 6).  Use Filter ->
Blur -> Gaussian Blur at 10-30 pixels to smooth any remaining rough spots out.

11.  All that work for a blurry mess?  What you now have is your original image on the first layer and a picture of the image's light
pollution on the second with no stars or other objects.  Why would you want an image of light pollution, though?  Simple:
To subtract it
out from the first image and get a nice black background
.  On the Layers window, click on the arrow next to the word Normal and
select Difference, and looky at what happens!
(Image 7)

12.  Use the Image -> Image Adjustments -> Curves function on the lower level to brighten the background by about 10 pixels (add
points at (0,10) and (245,255) ) in order to avoid clipping the image (losing faint detail because the background is too black)  Flatten the
image and save your work.

13.  Now we get to the fun part!  Go to Image -> Adjustments and take a look at all of the options that pop up.  80% of the time, I find
that I only use Curves and levels from this menu, but occasionally I use other options.  Try opening the Curves window and clicking to
one side of the diagonal line near the lower left side.  If you click above it, those pixel values get brighter, while if you click below it,
those pixels get darker.  The line basically shows the pixel values for 0 (totally black) to 255 (totally white), and you can set multiple
points along the line - which is helpful when you want to make certain faint areas of your image brighter while keeping noise to a minimum
and not over-brightening the brightest stars.  Experiment a bit and try to make your image brighter (click above the line) while still
maintaining a cood range of pixel values (highlights, midtones and shadows).  The unfinished image at right is a composite of the 24
frames processed only with Curves.  
(Image 8)

13. If you find that you have pushed the brightness too far in the low end (i.e. background is too light) you may have to use Image ->
Adjustments -> Levels and raise the leftmost slider until it almost touches the graph (the graph is called the histogram - it shows how
many pixels of each value - 0-255) your image has).  Raising the left slider sets the "Black Point" higher - which means that that new
value - say 10 - now acts as if it were 0 and the other values are adjusted accordingly.  This process, called histogram stretching, is
covered more fully in
The New CCD Astronomy.

14.  If you want to change the color balance of the image, you can use curves on just one color channel (Red, Green, or Blue at a time
by clicking on the arrow next to where it says RGB and selecting Red, Green or Blue.  The Digital Rebel is not as sensitive to Red as it is
to Blue or Green, so I often find myself decreasing the Blue channel a bit while increasing the Red channel a bit.

15.  What you do from here is completely up to you.  Check out the various filters under the Filter tab.  Filter -> Sharpen -> Unsharp
Mask at around 50%, 1.5 pixels, 0-1 threshold is nice for brightening and sharpening stars, and Filter -> Blur -> Gaussian Blur at 0.3
pixels is nice for smoothing out any remaining noise without overly blurring your image.  Using Select -> Color Range or the Lasso tool
(round dotted line) allows you to select only specific parts of your image to apply filters to (Only blur dark background, only brighten
faint stars - think of the possibilities!).  The final image shows M13 after all of the processing, including all of these steps listed and a few
more.  Compare this image to Image 1 or 7 and see the huge difference!
(Image 9)

Hopefully this tutorial will help you beginning imagers out somewhat.  I still recommend that you pick up The New CCD
by Ron Wodaski (around $50) as it has several more helpful tips, but the above steps should make your raw,
somewhat grainy images look much more smooth and high-quality.  Good luck!

Chris Hendren
Back to last page
Intro to Astrophotography Image Processing with Photoshop
M13 - raw
M13 - Median filter on top layer - slider at 30 pixels
M13 - use clone stamp to blend away bright spots
M13 - blending set to Difference and Light Pollution Gradient removed
M13 - two misalligned frames after LP gradient subtraction
M13 - two frames properly aligned
M13 - 1 layer (Left) versus 5 layers averaged (Right)
M13 - 24 frames combined, processed with Curves
M13 - Final Image (cropped from original frame)