Posted on Leave a comment

How to do Exposure Compositing in GIMP

One of the more challenging aspects of nightscape photography is getting the foreground to appear as striking as the background stars in the image. While it’s possible to shoot both in the same exposure, I’ve found it easier to shoot them with separate exposures and merge them in post. In this article, I share my process for exposure compositing.

Getting Started

Before we dive in, you’ll need a few things:

The GNU Image Manipulation Program (GIMP): GIMP is a free, open-source photo editor with many features similar to Adobe Photoshop. I wrote this tutorial using the latest development version, so things may look a little different than the current release version.

GIMP Download Page

Foreground and Background images: If you’ve already shot your own foreground and background images, feel free to use them, or you can practice with these medium-resolution images from my Dog Head Burn Scar shoot (click to download).

foreground.jpg
stars.jpg

For more information on how I shot these, you can skip to the tail end of my tutorial on How to Expose the Foreground in a Nightscape. After you get GIMP installed and have a decent set of foreground and background images to work with, let’s get started!

Layers and Alpha Masks

GIMP, like Photoshop, has a layering system, where individual images can be layered on top of each other. How GIMP decides which portions of which images are displayed in the final rendering depends on the position of each layer in the stack and the transparency at each pixel of each layer, known as the layer’s alpha channel.

Think of each of the pixels in an Alpha channel like values from 0 to 1. If a pixel in the image has an alpha value of 0, then it will be rendered as completely transparent. If it’s 1, it will be rendered completely opaque. If it’s somewhere in between, it will be blended with the pixels in layers further down the stack. This process is called alpha compositing.

At this point, go ahead and fire up GIMP, then click File → Open As Layers …

Figure 1: GIMP immediately after launch, with the “Open As Layers…” menu item selected.

Choose your foreground and background images, then click Open.

Figure 2: The “Open As Layers” dialog in GIMP. You can choose more than one image at a time by holding CTRL and clicking the specific image files you want.

Once you’ve opened your foreground and background images as Layers, the GIMP main editor view should now look something like this.

Figure 3: Foreground and background images loaded as layers.

 

Creating a Layer Mask

Notice how only the top layer (stars) is visible. This is because neither image had any transparency configured. Since all layers except the Background are opaque, only the top layer is visible. We need to configure a transparency channel, or Layer Mask for the top layer to tell GIMP which portions of the background should be opaque. To do this, right-click the Stars layer and select Add Layer Mask …

Figure 4: Choosing the “Add Layer Mask” option for the Stars layer.

A quick dialog will appear immediately after choosing this option, asking us how we want to initialize the layer mask. We want to leave the default setting of “White” selected, because we want to start with a completely opaque stars layer.

Figure 5: Add Mask Dialog.

 

Now that we’ve got our layer mask initialized to white, the main editor should look something like this. Notice how there is now a white rectangle next to the thumbnail image of our Stars layer in the layer view to the right. What this means is that the star layer now has an alpha channel, and that alpha channel is set to all-white. Because the mask is entirely white, the star layer is still entirely opaque.

Figure 6: Star Layer Mask Initialized.

Brushing the Layer Mask

Now we need to set the star layer’s alpha mask to include transparency over the foreground. To do this, we need to set everything in the layer mask that covers the foreground to black. We also probably want the edges between foreground and background to blend softly together. We can do this by configuring the paint brush tool.

In the Toolbox window (left side of my screen shot), select the Brush tool. Lower the Opacity of the brush to about 10-15 percent, then choose a brush with soft edges. You may want to also lower the “Hardness” of the brush. Also, be sure to set the brush to “incremental”, as this will make successive passes of the brush over the same area increase the intensity of the alpha transparency being painted.  Here’s what my brush looked like initially.

Figure 7: Configuring your layer mask brush.

Next is to test the brush out. First, ensure that the top color in the brush tool is set to black (left side of the screen), then select the star layer’s mask by clicking the white rectangle next to the star layer thumbnail in the Layers window. Now, click and drag around in a dark area of the foreground of the stars layer.

Figure 8: Foreground brushing begins.

You’ll see the foreground layer begin to appear. You’ll also see a black region appear in the layer mask’s preview in the layers window. You’ll need to brush over the entire foreground area this way until you’re satisfied with the final look. You’ll probably need to experiment with the size of the brush as well as its hardness and opacity, especially near the boundaries of the stars layer and the trees in the foreground. This will likely take you some time – it took me about 90 minutes to get things the way I liked them. Here’s how my edit ended up.

Figure 9: Layer mask brushing is complete. There are no hard edges between the sky and the trees in the foreground, which makes the scene look more natural.

Save Your Work!

Now that compositing is done, be sure to save your work! GIMP has a couple of options for saving images. You can either save your work as an *.xcf file, which preserves all of your masks and layering information (choose “Save As…” from the File menu) or you can save it as a raster file such as a JPG, PNG, or TIF using the “Export As…” option.

Figure 10: Choosing the “Export As…” option. “Save As …” is just a few menu items above.

Just remember to choose “Save As” if you wish to revisit your compositing at a later time. The Export option is compatible with most popular image formats, but it does not export any of your layering or masking info, just the final rendered image.

Final Thoughts

Compositing foreground and background exposures in GIMP is a simple process, and best of all, it costs nothing. You don’t need an expensive license for Photoshop to get great results. For this particular image, there’s a lot more that you can do to really make it pop (click here for an example), but I’ll leave that for another tutorial. In the meantime, give foreground compositing with GIMP a shot and let me know how things go in the comments below!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.