Trimming away the Excess (Photoshop)

I created a problem for myself twice and with the Total Lunar Eclipse coming in April, 2014 I suspect I’ll be creating the same problem again.  I wanted to record a time-lapse of the May 20, 2012 Annular Solar Eclipse as well as the June 5, 2012 Transit of Venus.  I used a solar filter and an Equatorial Mount to help me track the sun. Unfortunately getting a good polar alignment during daylight is beyond my skill set. Without good alignment I had to manually repoint the telescope rather frequently. It is not necessary to understand any of the gobbledygook you just read except to know that the sun was MOVING from frame to frame – see the image below.  With all that movement, a time-lapse looks like a jitterbug dance.  In fact, this artsy composite shows just how much the sun moved around in my frame – that is, all over!

Solar Art

Annular Solar Eclipse with un-centered and trimmed frames. AKA Solar Art the “dots” on the sun are large sunspots.

My friends suffered from similar problems and each of them undertook automated solutions to the problem using Photoshop or something similar.  My goal was to solve the problem in a generic way and along the way I learned some useful additional Photoshop tricks.

The Solution

I used the trim feature of Photoshop.  You can find Trim under Image -> Trim.

Trim makes note of the current value of the upper left (or lower right) pixel. It then creates a selection that includes all of the rows and columns that have the same value and inverts the selection. Finally it crops off all of the selected area into the smallest possible rectangle.

An easy way to think of this is: imagine a dark photo with a white frame around it.  By using “trim” the entire white frame will be cut away.  The same approach works if the frame border is black, blue, transparent, and so on.

But there is a catch!  There is no tolerance setting for the trim value so whatever needs to be trimmed must be an exact color match. Unfortunately this presents a problem because even in a photo of a black sky, the black areas are not uniformly black.  Some values may be 0,0,0 but others 1,2,1.  And then there is noise!  Even though you may not notice a difference between two adjacent pixels trim only operates on those pixels that have EXACTLY the same value as the upper left or lower right.

To get trim to work in a reasonable fashion, therefore, we must turn all of the almost black pixels into black (or some other color).  I feel a Photoshop trick coming on here. Our trick is to use a duplicate layer and adjust it to cause it to trim the way we want. We will discard the duplicated layer when we are done.

Trim-o-Matic

  1. Open the image.
  2. Duplicate the image as a new layer.
  3. If the duplicate layer is a smart object, convert it to a raster layer. (To convert a smart object to a Rasterized Layer, open the layer palette, right-click on the duplicate layer and select “Rasterize Layer”)
  4. On the duplicate layer use
    “Filter -> Noise -> Dust and Scratches” with Radius = 3 and Threshold = 3.
  5. Make sure your foreground color is black (x is the hot key).
  6. Use the “Fill” tool (paint bucket) with tolerance set to 40, Opacity 100%, Mode = Normal and no options checked.  Click the extreme upper left pixel. Fill will replace all of the outer area with black. You may want to click multiple times.
  7. If you have some areas that are brighter than the object, you may also want to apply a brightness and contrast adjustment.
  8. Use the trim function on the current layer with all boxes checked and “Top Left Pixel Color” selected.
  9. Trimming changes both the working layer and the original layer below it.
  10. Discard the working layer.

Here are the steps in illustrations.

Rasterizing a smart object

Rasterizing a smart object

PS_DustAndScratches

Dust and Scratches settings

gs_2014-03-23_084744

Filling with black

Filling with black (might need to repeat this)

Dust and Scratches + Fill may not be enough. Fortunately the duplicate layer can be severely adjusted if needed since it will be discarded.

 

Trimming Tool

Trimming Tool

Select Areas for Trimming

Select Areas for Trimming

 

After Trimming

After Trimming

Delete the Extra Layer

Delete the layer that was created for the sole purpose of trimming

 

What If It Crops Too Tightly or Inconsistently?

This set of steps written as an action can be used to automate the process of trimming. There are still a few remaining problems to work out. Sometimes after trimming the total horizontal or vertical pixels of the object the resulting image size will differ by one or two pixels. To solve the “dimension” problem, the simplest method is to use Image -> Canvas Size. Set the canvas to about 20 pixels larger in each direction. Select “center” (the dot in the middle next to anchor) and set the fill color to match the background.

Expand the canvas and center the image

Expand the canvas and center the trimmed image

After Trim and Canvas Size

After Trim and Canvas Size

The above procedure will work quite well for animating a sequence of sun or moon shots – except for eclipses.  Eclipses don’t work properly because an edge of the sun or moon disappears leaving no edge to properly orient with the others.

What can we do when we no longer have constant edges to align with?  Divide and conquer! Instead of trying to apply the same action to all of the images, we will can change edge we select when enlarging the canvas size. We can orient sets of images based on which part of the image remains constant.   Which edge or corner should you pick? Pick the edge that stays the same (if there is one!)  For an Annular solar eclipse, at least one of the directions will never be darkened – that’s the one to pick!  The annular eclipse sequence shows that the upper left limb and lower right limbs of the sun remain present in all of the shots.

Field Rotation

There may still be another problem: Field Rotation. If you’re thinking that perhaps this has something to do with improving crop yields on a farm, sorry to disappoint you. The Annular Solar Eclipse and the Transit of Venus were events that took place over a period of from 3 to 5 hours.  During that period the earths rotation causes the sun, moon and stars to move. It also causes them to “turn” as viewed from terra firma.  You can see this for yourself if you watch the full moon from moonrise to moonset. At moonrise make note of the orientation of the “man on the moon” and compare it with the orientation at moonset. Go ahead and watch. I’ll wait for you.

So what do you do if you have this field rotation?  Either live with it and accept that the animation won’t be entirely accurate, or you’ll have to do a much more complicated set of operations by progressively rotating the images.  That’s more than we want to tackle, so you’re on your own for that!

The Results

The Annular solar eclipse sequence. The Abstract Solar Art image at the top of this article was created from the un-centered and trimmed frames. Obviously this wasn’t perfect – in part due to clouds and shimmer in the atmosphere.

Not seeing the above video? It requires FLASH, so click here to watch.

Obviously this one had some trimming errors… and nasty dust on the sensor but this is the once in a lifetime Transit of Venus.
Not seeing the above video? It requires FLASH, so click here to watch.

Catching the Moon Simplified

Freedom Gazes at the Moon [5_055475-7deB]

Freedom – the statue at the summit of the Nation’s Capitol – Gazes at the rising Moon

One of our popular webinars is Night Photography 111: “Catching the Moon (and the sun)”. The next webinar is April 2, 2014, by the way. Long before the many tools that now exist to help solve for moon+landmark alignments I began working on a tool I call the MoonChase Tool. As snazzy tools came into being like Stephen Trainor’s Photographer’s Ephemeris, SunMoonCalc, MoonSeeker, and many more, I neglected the MoonChase Tool and focused more attention on the Advanced Stacker PLUS. In fact, after Google discontinued the V2 map interface upon which MoonChase was built the tool languished for about a year and a half. I also stopped teaching how to use it in the NP111 Webinars. But, I kept finding that all existing tools just didn’t do what I needed, so I resurrected the MoonChase tool. I ported it to the newest Google Maps API (V3), and I then added some of the features I had on my wish list.  I’m really proud of what the tool can do now. And I have some fiendishly clever plans for the future of the tool, time permitting, of course. Operationally the MoonChase Tool is simple. The hardest part is coming up with the location where you want to stand and the landmark you want to face. If you know that there is a sightline to a landmark in the distance you can fire up MoonChaseTool and in 3 steps know when to go to get the moon or sun behind your landmark!  That’s right. You paste, paste, click and click. Or drag, drag and click. We cover how to cook up good locations in the Webinar. How do you get your hands on this tool? We’ll tell you! If you’ve attended a NP111 webinar with us, or purchased the video and notes you already HAVE access through the “private page” (you did save the password, right?).  You’ll find the link to the MoonChase Tool on the private page.  Or sign up for our webinar which includes the notes and video AND access to the MoonChase Tool – and you don’t have to wait for the webinar, we send you all the links when you sign up (see below). The tool isn’t especially pretty, we admit that.  But it is pretty EASY to use and it works even from your iPad or tablet as long as you have internet access.

3 Steps to Moon (or sun) catching

3 Steps to Moon (or sun) catching. And there is more: you can check the view with Google Street View, and even check the weather with the weather button.

After clicking “Moon” you get the report thanks to Jeff Conrad’s SunMoonCalc tool. Be careful to be sure it selects the time correctly. Below it’s off by an hour due to Daylight savings time.

LickFromSJC

Moonrise over Lick Observatory from near SJC Airport… all opportunities from this location for the next 4 years!

 

What Problems Does the MoonChase Tool Solve?

The tool was designed to do the trigonometry for you. Did you know there is trigonometry involved?  Don’t worry, you don’t have to know trigonometry or math.  Nor do you have to know about spherical coordinates, azimuths, altitudes or the three different kinds of twilight.  All you have to know is where you want to stand, and what you want to be in your picture. Drag the markers around on the map and click one of the Solve buttons. OR use the tool in concert with The Photographer’s Ephemeris.

What Do I Need to Know to Do?

It’s very helpful to be able to do the following things: grab GPS coordinates from Google Maps and/or Photographers Ephemeris.  We teach how to grab GPS coordinates in the course. You’ll also want to know how to find heights of your favorite landmarks. Google comes in really handy for finding heights of buildings!  One more thing you’ll want to verify is whether you can See the landmark from the place you want to stand. Again, we describe 4 different ways you can do that in the webinar. The rest is dragging and clicking!

How Long Will it Take?

If you already have the coordinates, it will take perhaps thirty seconds – or not even that long.

I WANT THAT! How Do I Get It?

Easy: Sign up for the webinar and you’ll get immediate access to the private page plus the videos and notes. If you’ve already taken the webinar, go to the private page and you’ll find the link in the Resources section.  Or as a prior purchaser, just sit tight as we’ll be sending the new materials out to all prior purchasers over the next 3 weeks.

2014-05-07  Webinar: NP111 Catching the Moon and the Sun
Next Event Wednesday, May 7, 2014 7:00 PM PDT (7 MDT / 8 CDT / 9 EDT) for 2 hours
Captured [C_044450-2tc] In this 110 minute Webinar, you will be introduced to several free (and almost free) tools that you can use to plan a moon (or sun) shot - including a tool written by Steven and made available only to attendees. Have you wanted to capture the moon "right where you want it" but weren't sure how? If you know you could resort to photo editing and fake it but you'd rather get the real deal then this class is for you. Steven will demonstrate how to determine when and where to go to capture an image like the Moon over Lick Observatory or the moon at the Transamerica Building or the sun shining through a portal in the Pacific Ocean (below). This is a Webinar so you can conveniently attend from your computer at work or home anywhere in the world. This course includes notes, access to a private page with details - including landmark events Steven has already solved for you, an online viewable recorded webinar with unlimited online viewing that you can watch NOW before the webinar is held. One indispensable tool covered in detail is the Photographer's Ephemeris by Stephen Trainor.

What You'll Learn

Steven will show
  1. How to Plan a moon or solar "contact" shot.
  2. How smartphone based tools may help - or sabotage - your attempts to get an alignment
  3. How to use the moon to illuminate your foreground,
  4. How the presence of the moon affects photos of the night sky,
  5. How to find information about interesting celestial events,
  6. How to find compelling locations for "alignment" images, and
  7. What camera settings you need to get it all exposed just right.
Photon Worshippers **Winner Astronomy Photographer of the Year, 2010 - People and Space **
Remember that this event INCLUDEs online videos, notes, and access to a special tool that Steven uses to solve lunar and solar contact shots.

New Dome [5_009671]

The moon rises behind Lick Observatory on Mount Hamilton, San Jose, California

Doing things Backward in Advanced Stacker PLUS

Push Me - Pull You

Star Trails tapered in TWO directions… read on for how.

First we confess… Doing things backward applies to all manner of operations, not just Advanced Stacker PLUS so this technique is useful for almost any kind of batch processing.

By far the most IMPRACTICAL way to stack your shots in reverse order is to reverse time before taking your shots so that they will be numbered as you wish. Another eminently impractical way to shoot star trails backwards is to reverse the earth’s rotation before shooting that sequence of shots. :-)

We’re pretty sure you are looking for a more practical solution, though! And here we offer a strategy that takes full advantage of Photoshop’s relentless bent on processing photos in alphabetical order.  To make everything run “backward” we need to reverse the alphabetical order of the photos.  Unfortunately, there is no number these files backward feature. We wish! There are some standalone programs for doing sophisticated file renaming but here we will use a tool you already have: Adobe Bridge. Adobe Lightroom can be used too – if you are anxious to know how, leave a comment and we will elaborate.

Here is a quick comparison. The first shot is “reversed” causing the stars in the Northern Hemisphere to be rotating clockwise instead of the counter-clockwise direction that they ACTUALLY move in.  While exactly the same shots were used in each case, the photos reveal one reason why you might want to reverse the order – to get a sky flavored with a bit of twilight blue.

130-41ReversedComet 130-41Comet

We have a lengthy article on how to use Adobe Bridge to feed the Advanced Stacker PLUS, so let’s start with using Bridge.  Below is what our directory of files looks like. We compacted our Bridge display to make it easy to get a reasonable size screen capture. We slid the  leftmost divider (normally it shows filters and folders) to the left.  Notice the “content” pane contains thumbnails and the Preview pane shows the two files we selected – one obviously taken earlier when there was yet some blue twilight, and the other taken later.

Reversing the File Order – Adobe Bridge

gs_2014-02-26_081542

 

Arrows below indicate places where we can control the view that Bridge shows us.

gs_2014-02-26_081602

Some key controls for manipulating the Bridge display are shown.

gs_2014-02-26_084841

NOTE: You do not have to change the view, you can use the Sort option and uncheck the “Ascending” order.

We find that the easiest way to reverse the displayed order is to change to List view. And then click on the header to reverse the sort order. While we can change the sort order directly (see sidebar) we prefer the neater view we get in List mode.

Clicking the triangle on the Name column at the top of our content pane reverses the sort order and results in the display as shown at the right.

gs_2014-02-26_081642gs_2014-02-26_083730

Unfortunately Photoshop will not be swayed by the different sort order… it insists on processing files in ALPHABETICAL order. Our solution is to change the names of our files to reflect the desired ordering.

Batch Rename

gs_2014-02-26_082045

Batch rename (under Tools) gives us the ability to copy or move files while renaming them.  Fortunately when we use the rename tool, it DOES respect our sort order. Our strategy is to use our reversed-order file list and place an increasing sequence number at the beginning of each file name. By prepending to the file name we can force the first file in our sorted list to become first alphabetically.  Bridge has a built in “Sequence Number” which automatically increments.

We do this often enough that we took the extra step to save the configuration as a preset.

gs_2014-02-26_082508
Adding a 3-digit prefix followed by a dash character. To add or remove items from the rename click the + or – icons.

The important points are:

  1. We must prefix a sequence number.
  2. We strongly suggest “Preserving the current file name in the XMP data” so we can return the files to the original name if we wish.  Or instead of renaming them, select “copy” and place the result in a separate folder.

Once we have our renumbered files, we can feed them to Photoshop just as we described in the Stacking with Bridge article.  And, if use the “preserve file name in XMP” option, we can easily rename the files back to their original names using the batch rename. The small trick for this is described at the end of the video below.

Batch Renaming – The Video

Reversing the ordering of files for Advanced Stacker PLUS (Using Adobe Bridge)

 

Using Lightroom To Rename

Using Lightroom has many drawbacks as we previously described.  Lightroom also has a rename function (F2), it is, however a bit more tedious to set up.  The other important thing to remember about using Lightroom for stacking is that Lightroom insists on exporting files before you are able to stack them.  And because of these two complexities, we decided to stop writing here.  If you really want to know how to use Lightroom to accomplish the same task, plead with us in the comments below.  Or better yet, offer us bribes!

The 5 Most Used Photo Enhancement Techniques – Part 2

You are back! Good. In the last article we talked about White Balance and Noise Reduction. As two of the five most useful tools in the arsenal of the night photographer.

In this article we will tackle two of the remaining items:

  • Exposure and Contrast enhancement
  • Sharpening (and de-sharpening)

Healing and cloning will be in Part 3.

While we have seem some fascinating composite and highly edited images our goal is usually to make a compelling photo. But we do like realism, too. So while we will show techniques that can be pushed to extremes to make gaudy Milky Ways, or super saturated star trails, we personally do not go there often.

Exposure and Contrast Enhancement

Below is the result we want to achieve.

640_4

Single Exposure with exposure and contrast adjustments, healing, cloning, selective blurring and sharpening.

But we will be starting with a single daylight exposure from the Outer Banks, North Carolina. When we shot the scene we shot a bracketed exposure at one-stop intervals. Before we look at the exposures, let’s look at the histograms from each of the three exposures

RodantheHistograms

Which one is the best image to start with to make our adjustments? Hint, it’s the one at the right. The +1 exposure has no loss of detail because nothing has been over exposed.  Here is the exposure.

+1 Exposure

+1 Exposure

The scene seems flat and lifeless – almost nothing like it looked to the eye, and not close to what we hope it will be. Part of the reason it looks so flat is that we have not done any adjustments to the original RAW file. If you shoot JPGs the curves and saturation adjustments are automatically applied so you might conclude that RAW images are a waste of time. That would be wrong. The truth is there is much room for improvement in the RAW images and much of the “good stuff” is lost when the camera applies the conversion to JPEG.

All of the histograms show decently exposed images. But it looks like even in the +1 image we still have some room left. That is, we could have exposed a bit more to get the whites all the way to the right.  All of our histograms show that we have no black (nothing at the left edge), and no white (content at the right edge).  An underexposed image might have richer color but it will suffer when we boost the exposure and contrast. The lighter exposure will suffer much less degradation. In fact, the act of reducing exposure deepens the saturation – we do not have to play with the saturation sliders at all!  Pleasing saturation shifts from adjusting exposure are one of the many good reasons why exposing to the right (ETTR) is an effective strategy.

Adjusting Exposure and Contrast – Lightroom Auto

There are many ways to adjust contrast and surprisingly the “Contrast” slider is not usually the most effective way. Using contrast alone often makes the lights too light and the darks too dark. One thing you can try is to use the “Auto” button. It sometimes works. In fact, for these images, it works pretty well with the +1 exposure, but not as well with the normal exposure.

The "Auto" feature of Lightroom under Basic settings

The “Auto” feature of Lightroom under Basic settings

Here is what Auto did for this image:

Lightroom Auto Adjustment

Lightroom Auto Adjustment

The histogram has been stretched and the image looks pretty good. Note that we’ve turned on the clipping indicators by clicking where the white arrows point. After Auto we found a few small spots where black level clipping has occurred as indicated by blue blobs which are circled in red above. No big deal. You can also see what Basic adjustments Lightroom made – exposure has been reduced by one stop, contrast +20, whites +62, blacks -50.  We now have an idea what the Basic adjustments can do. Auto almost never creates a good result when working with dark or night images.

Adjusting Exposure and Contrast – Lightroom Tone Curve

There is another way, and in our opinion, a more powerful way to adjust the exposure and contrast and that is using the Tone Curve. One reason we prefer this method is that it has an almost exact analog in Photoshop (Curves), as well as an almost identical behavior if using Adobe Camera RAW.

Lightroom Tone Curve

Lightroom Tone Curve

What we want to do is to darken the shadows and midtones and slightly lighten the bright areas without losing information – that is to adjust the exposure and contrast. The process is called “stretching the histogram”.  It’s pretty straight forward. Click points on the curve and drag up or down and left or right to create a new curve while paying attention to both the image and the resulting histogram.

Before and After Tone Curve Adjustment

Before and After Tone Curve Adjustment

Can you make these adjustments using Adobe Camera RAW? Yes! The controls are nearly identical.

This is now a good starting point to apply some additional pop, But what if you wanted to do this in Photoshop?

Photoshop Exposure and Contrast using Curves Adjustment Layer

Histogram Stretch using Photoshop

Histogram Stretch using Photoshop

The image above has brought out a bit of pink in the sky, but the dune is a little flat and a little dark. The good news is there is a way to give specific colors special attention – using what we call the “twiddle finger”. You click the hand icon, then pick an area of the image you would like to brighten or darken. The luminosity selected is shown on the graph, then you drag the mouse up or down.

Twiddle Hand curve adjustment

Before Twiddle Hand curve adjustment

 

After twiddling.

After twiddling upward a bit

The twiddling can be repeated. Beware, though, twiddling is global, not local. In general the tone curve should always be flat or upward as you move left to right otherwise you will be lightening dark areas to the point where they become lighter than adjacent light areas.  One way to improve your curve is to smooth the graph. Click the pencil icon then the icon below it (graph adjust), then click the graph (above the pencil).

After a bit more fiddling and twiddling we get what you see below. What more fiddling? Well, we like to add another adjustment curve and select the “Increased Contrast” option.  If things were close to good to start with, the curve might go too far, so adjusting the layer opacity downward is the solution.  In fact, we use the “Adjust contrast curve” so often that we created an action for it and assigned it its own hot key (F9).

640_2

Original Exposure Contrast Enhanced, Histogram Stretched, fully twiddled :-)

Now we have quite a bit more drama, and much more contrast.  Where are the distractions? What leads your eye away from the interesting parts of the scene?  What are the interesting parts of the scene? Now is a good time to make note of the distractions, because soon we will conquer those.

In truth, we have one more thing to address in the exposure category. The sky is a bit too bright. The solution is to apply a gradient using either Adobe Camera RAW or Lightroom (it can be done in Photoshop but it is harder than it should be, and less convenient).

Graduated Skies – Lightroom

The graduated filter (M) is our friend for not only darkening the sky, but also making other adjustments. That you can make multiple adjustments simultaneously is one thing that sets it apart from the Photoshop methods. Here we have zoomed to 100% to show both a portion of the sky and the location of the graduated filter tool. Note that the sky is a bit “gritty”. We will fix that!

Graduated Filter tool and gritty sky

Graduated Filter tool and gritty sky at 100%

Our sky fix will illustrate one of our other techniques: selective sharpening – only in this case we will de-sharpen to remove the “grit” as follows.

Applying a Gradient to the Sky

Applying a Gradient to the Sky

We use a sky gradient so often that we created a pre-set for it.  The preset reduces exposure by -0.76, contrast by -17, saturation by -24, sharpness by -40, and noise by +100.  Those last two, decreasing sharpness and increasing noise processing result intentionally in blurring. In this case the exposure correction is a bit too strong, but that is easy to fix by bumping the exposure up a little (-0.51).

Let’s look at what this gradient did to our sky. Notice how the grit is just about gone.

gs_2014-02-08_122146

 

If you are thinking that applying a gradient to darken the sky is somehow dishonest, then please don’t use a graduated neutral density filter (GND) which does the same thing at image capture time – but a physical GND does so less elegantly!

Sharpening and Desharpening

We snuck in a trick to desharpen a mottled/gritty sky above, so please read that for one direction. In fact, we find that using noise reduction is often the most effective way to soften because the result – if not pushed to an extreme – is often more satisfying than using any other method. But some things need a little sharpening, like the eyes and hair of people, the boundaries between objects in a landscape.  When we want to do sharpening we never (ok, almost never) do global sharpening.  One reason we do not globally sharpen is it tends to make mottle things more mottled – like the gritty sky we showed earlier.  It seldom makes sense to sharpen clouds or things that are not sharp by their nature.

Indeed in our beach scene there is really nothing that demands sharpening, but all the same, we’ll apply a little bit at the sky/ground border – mostly to help the sea oats stand out a little more. It’s tempting to think that the Lightroom adjustment brush “sharpen” tool is the right one to use here, but often sharpen alone is not as effective. When sharpening is overused it creates odd artifacts. Often the more effective way to sharpen is to use a bit of “clarity” as well as sharpening. Clarity is a local contrast adjustment which has no analog in Photoshop. If you want to use clarity in Photoshop you must bounce over into Adobe Camera RAW. In Photoshop CC you can get a layer into ACR using the Filter -> Camera Raw Filter dialog. Lightroom and ACR are very similar, so lets show ACR here.

Adjustment Brush in Adobe Camera RAW

Adjustment Brush in Adobe Camera RAW

After setting all the adjustments to zero (easy in Lightroom, just double click on each item), we set the Clarity up (+15), and the Sharpness up (+6). Adjust the size, feathering, density and flow of the brush and paint along the horizon and through the grasses.  It’s always better to go a little at a time than to try to go all at once.  When done hit apply or Open.

In Photoshop we often take a completely different approach. Instead we duplicate the layer, label it “Sharpened” then sharpen (using the smart sharpen filter) or noise reduce the entire layer and then mask it all off. We then “paint back in” the areas we want a correction applied to using a white brush on the mask.

Wow. We’ve spent quite a lot of time talking about exposure enhancements and sharpening and desharpening, so spot removal (cloning, healing and cropping) will appear in part 3.