Tag Archives: foreground

Foreground – o – Matic

Published: 2011-Dec-24
Last Updated: 2018-Jun-04

One of the lovely things about stacking star trails (or stacking in general, for that matter), is you are presented with many opportunities for a choice of foreground. Did someone walk through your shot wearing a flashing nametag? No problem. Did a passing car blow out that wonderful rock in your foreground… no worries.  Did you play around with different lighting and find none of them quite met your desires. No cares.

Invariably at workshops and shooting events something will go wrong with hours long shots. But with a plethora of shots to select a foreground from the odds are greatly improved that you can get what you wanted even if it means working around problems created by uncontrollable elements.

Consider my effort atop Mauna Kea.  All the shots are here in this video.

Last Night at Mauna Kea

But as you may have noticed, the radio dish was moving nearly constantly and is thus blurred in many shots.  When I stacked all the images together in the normal fashion, this is the result:

Unless you’re into that Dali-esque melting radio telescope vibe you may not want that result.  Or perhaps some dunderhead walked through the scene with a flashlight making a wicked blow out – or any number of possible complications. What to do?

Answer: Find the image or images with a more desirable foreground and fix it!  Fortunately I have LOTS of frames from my 7 hour-long star trail. When I created the image originally I chose this foreground:

Resulting in this image which was selected for the shortlist of the Astronomy Photographer of the Year, 2011.

Listening to the Sky [B_025555-714]

But, in putting together this article I noticed a foreground I think will work even better. This one:

The result will be the radio dish “staring” into the center of the star circle. So lets replace the Dali-Esque portion of the original stack with the foreground above.


Here are the steps we’re going to take – you can download the images using the links below and try for yourself if you wish – of course you may not post your derivative work or claim it as your own.

  1. Start Photoshop
  2. Load the foreground and background (stacked) image.
  3. Plop the foreground image onto the stacked image.
  4. Set the foreground opacity to 40% to see what you are working with
  5. Use the quick select tool to capture the foreground elements you wish to remain.
  6. Use “Layer -> Layer Mask -> Reveal Selection”
  7. Adjust the foreground opacity to 100%
  8. Flatten and save!

Step By Step

Easiest for me is to drag and drop my images into Photoshop. Choose your own method if you’d rather but beware that depending on your approach, Photoshop may decide to do your layers as “smart objects” which creates more constraints and steps.

Note that you might decide to load more than one foreground so you can mix and match to choose what result you like best!

Once you’ve got your two (or more) images loaded select the foreground image, then Ctl-A (Select All), Ctl-C (Copy) then select the background image and do Ctl-V (Paste). If you have more than one foreground, repeat the process of overlaying the foregrounds onto the background stack.

When done this way with equally sized images, the layers will be exactly over one another. You can accomplish the same layering goal by using the “move tool” and the process described by Harold Davis as “Plopping”. Or if you were really on the ball, you could  load the images into Photoshop as Layers. For me that method “Files -> Scripts -> Load Files into Stack -> File / Folder Selection tool” is unnecessarily complicated and forces me to use the more impoverished Photoshop file selection tool. Plus I can almost never remember to look under “File -> Scripts” (I always expect it under “File -> Open” or File -> Automate. Even File -> Import would make more sense!)


Though it is not necessary here, it is usually a good practice to convert your background to a layer, and name your layers to keep them straight.

We will also adjust the opacity of the foreground to around 45% by selecting it in the Layer tool (Window -> Layer)





After adjusting the opacity, we can see clearly how the layers align and make a determination about which parts of which photos we want in the final image.

A quick look indicates that we can replace everything below the mountains with our foreground making the task trivially simple.  We will use the quick selection tool (look under “Magic Wand” if you don’t see it). Select the foreground, then click the selection tool somewhere at the edge and below the sky. Drag across the frame to the other edge and if you’re lucky, the selection will be like this:

The next step is to turn the selection into a mask so that the sky remains intact and the foreground is replaced by our selection.  Layer -> Layer Mask -> Reveal Selection does the trick.

After completing the Reveal Selection we adjust the foreground to 100%

For fun and excitement we can clean up the final concoction using various adjustments. Here I’ve used Curves and Hue/Saturation adjustments to reduce the green cast and crisp the image up just a bit.

Final image with replaced foreground

Now we flatten and save and post and brag!

What if Quick Select Doesn’t Work?

If your selection area is more complicated there are other alternatives.

One alternative is to use a gradient mask. But that may not work either such as when a tree reaches up into the sky with lots of tiny branches. Another approach is to do hand masking/layering. The following provides a rough idea of both how to approach the hand masking problem and how much more difficult the process can become.

Here I used a “Hide All” mask on the foreground. Next I painted in white on the foreground mask (notice that the mask is selected in the layer window). Wherever I paint white in the mask allows the foreground to “replace” the background. In this case it’s messy because the foreground is clearly darker than the background.  However this technique can work very well for small improvements. For example did you notice that there is a red streak of car tail lights in the middle mountain above?  It would be simple to replace that small area with one (or more) frames from the rest of the stack using this hand masking technique.

If you want to get the full scale, nitty gritty detailed write up of this hand blending technique, I heartily suggest you purchase Harold Davis‘s “The Photoshop Darkroom” book. It will be money well spent!

Or, join us on our next workshop or webinar.

Alignment (Part 1 of 2)

Sometimes alignment is everything. As an amateur astronomer at heart I am fascinated by the course of celestial bodies through the heavens and how they coincide with terrestrial features (is that strange?). Buildings, lighthouses, arches, and yes, observatories all beg to be photographed as they are kissed by the moon, the sun, or the Milky Way.

One example is shown in Photo 1, below. The moon is rising behind the Lick Observatory. The observatory is perched on the top of Mount Hamilton overlooking San Jose, California.  The photo was taken from the shore of Halls Valley Lake in Joseph D. Grant Park County Park. But it was not serendipitous – it was purposeful.  Days and weeks worth of planning were required.

Moon Lick [5_009717]

Photo 1: The full moon rises over Lick Observatory, Mount Hamilton, San Jose, California

An alignment of man-made artifacts and the moon occurred on the night of a total lunar eclipse.  It also was not completely accidental – but I can not claim I knew I would capture it:

Airplane Transits the Partially Eclipsed Moon

Photo 2: An airplane transits the partially eclipsed moon.

But sometimes the moon just happens to be in the right spot, as in this photograph by May Wong which captured the moon in an interesting alignment while hiking up a trail in Mission Peak Preserve.

Photo 3: (May Wong) The moon teed up on Mt. Allison's Tower

Many fascinating views of the sun and moon can be found in books by Harold Davis one particularly interesting example is “100 Views of the Golden Gate Bridge“.

Planning Moonshots

Ignoring happy accidents for a moment, getting the moon to align with some terrestrial object involves quite a bit of calculation. While there are some great tools to aid the lunar photographer (The Photographer’s Ephemeris, for example), it helps to understand why the moon is a difficult object to catch.  Starting with the first problem:

The Moon is BRIGHT

Jewel [C_029690]

Photo 4: Long exposure for details during a total eclipse - notice the few stars.

Indeed the moon is a very bright object as most people discover when they try to capture any of the details of the moon. Typically the full moon requires settings of f/9, ISO 100, and 1/100 of a second to preserve detail; but at night, those  settings result in everything else being a deep black, therefore to get moon details and foreground details there must be some illumination.  The best time is before sunrise or after sunset and more specifically the very best time is on the cusp between nautical twilight and civil twilight.  I will explain what those are in Part 2.  Of course the moon also makes planning harder by the changing daily illumination. In 29.53 days the moon completes one full cycle from new where the moon is in line with the sun and not illuminated; to full – opposite the sun in the sky and fully illuminated; and back to new. Surprisingly, however, the exposure needed to capture moon detail does not change very much until the moon becomes a slender sliver. When in the sliver phase longer exposures can capture moon detail in the darker (unlit) portions of the moon though this effort comes at the cost of blowing out detail from the lit edge.  In the extreme case, as when eclipsed (Photo 4) longer exposures are needed.

This brings us to the second problem:

The Moon’s Path through the Sky Changes Daily

As if the changing illumination were not enough the moon’s path through the sky  dramatically changes from day to day. At my latitude (39 degrees north) the moon rises about 42 minutes later each day.  The compass direction (azimuth) at which the moon rises and sets also changes significantly from day to day.   Capturing the moon near the horizon during twilight ALWAYS means attempting a shot of either a slender crescent moon or a full moon.  In most months at most 2 days near the full moon provide full moon capture opportunities. What about the other phases? During the first quarter, the moon is highest in the sky near sunset. During its last quarter the moon is highest in the sky at sunrise. So in short, at first and last quarter you have to shoot nearly straight up to get the moon.

NOTE: First quarter refers not to the amount of the moon that is lit – it is half lit – but to the phase. Similarly at last quarter the moon is also half lit.

Determining the rise and set times of the moon is not hard. Many sites feature the sun and moon rise times.  www.sunrisesunset.com is one site I like. sunrisesunset.com can generate a calendar for a whole month. With a little experience it is often enough to know what phase the moon is in. For me a calendar that does not feature moon phases is useless!

Once I choose which direction I will be shooting, I then know whether I must shoot near sunrise or sunset. Pigeon Point Lighthouse – my nemesis – is on the west coast. To capture the moon behind it the full moon must be setting – which means the sun is rising.  (It also means a 3:00 AM wake up to allow me time to drive to the coast!) Conversely when  attempting to capture the moon over the San Francisco Bay Bridge, the best viewing locations face east – meaning an evening (sunset) shot is best. One advantage to attempting the full moon is that the sun’s glow illuminates the face of the foreground whereas when shooting a crescent the sun and moon are on the same side of the sky so the foreground is in silhouette.

Now we face problem three:

The Moon is Tiny

In this wide angle shot, it is difficult to even see the moon! It’s there in the upper left, but with the 10mm lens the entire moon occupies about 467 pixels out of the 15,154,290 (15M) total pixels. That’s a paltry 0.03 percent of all the pixels in the image. Of course the moon is not tiny, it is very large but it is so far away that its angular size is 1/2 of a degree or about the width of your pinky finger at arms length.

When the Lights Go Down in the City [5_018683]

Photo 5: 20mm Focal length = tiny Moon... did you spot it?

Often my goal is to include a moon in a way that shows it large and well featured relative to the foreground. There is no practical way to get closer to the moon, so the way to make the moon larger in the frame is to use a telephoto lens (as in photo 1 and 2).

Putting the moon near some foreground element allows me to exploit the large moon phenomenon as shown in Photo 1. But it is not enough to use a telephoto lens – I must also be far enough away from the object in question so that the apparent (angular) size of the moon is nearly equal to the angular size of the foreground object. The proper distance can be measured with the pinky fingernail at arms length, or calculated with some trigonometry. In Part 2 I’ll supply a simple formula that works well. Meanwhile Figure 1 illustrates the challenges involved in positioning and “sizing” the moon relative to a foreground object.

Figure 1: Relative sizes of the moon based on distance from the foreground object. See notes.

NOTE: To keep the lighthouse the same size as shown in images A, B, and C above the focal length must be increased. Alternatively, using one fixed focal length pictures B and C can be cropped from a larger photo.

And there is another complication, too, depth of field. The longer the focal length the harder it is to keep the foreground and the background in focus. And one last complication:

Near The Horizon, Atmospheric Conditions have a Significant (Negative) Effect

Looking straight up there are about 50 kilometers of atmosphere to diminish the quality of a photo. Looking toward the horizon, that number is effectively 38 times as much! The sky must be clear of clouds and haze through the entire distance. And a more sinister thing occurs, too. The atmosphere bends the light. When objects like the sun or moon approach the horizon the atmospheric distortion can become quite noticeable as a vertically flattened object. And finally, due to refraction when the sun or moon appears to be setting, it in fact has already fallen below the horizon and remains visible only because of  refraction.  The take away here is that trying to capture a detailed moon at the horizon is not as effective as capturing the moon at least a few degrees above the horizon.

In Summary

To capture the moon near a terrestrial feature:

  • The moon’s current illumination must be managed.
  • The moon’s rising (or setting location) must be accurately calculated.
  • Exposures to capture moon detail require the right amount of foreground illumination (near twilight)
  • The location chosen must have an unobstructed view of the sky toward the desired direction.
  • To get a “big moon” it is necessary to get far enough away from the foreground to get the relative moon size as desired. If too close, depth of field problems arise.
  • A well supported telephoto lens is required.
  • Capturing a shot of the moon near the horizon means the atmosphere must be relatively clear of clouds, dust and haze.
  • Too low in the sky means there will be significant distortion from the atmosphere.

So there it is: all the complications that must be overcome in order to capture the moon. I just have not written HOW to overcome all those obstacles, that information is coming in the next installment.