Russell Croman Astrophotography  

 

 

GradientXTerminator

User Manual

System Requirements

  32-Bit Windows 64-Bit Windows 32-Bit Macintosh 64-Bit Macintosh
Processor Intel or AMD Intel or AMD
"x86" Architecture
Intel or PowerPC Intel 64-bit
Operating System XP SP2 and later
32-bit
Vista/Win7/Win8
64-Bit
Tiger (10.4) or later Snow Leopard (10.6) or later
Photoshop 5.5 or later CS4 or later CS2-CS4 CS5 or later
Photoshop Elements 5.0 or later

 

Installing the Plug-In

Click here for detailed instructions on installing the GradientXTerminator plug-in.

Image Requirements

GradientXTerminator works on RGB and Grayscale images, in 8-bit or 16-bit mode, although results are best if it is used on 16-bit images. To remove gradients in other images, first convert them to 16-bit RGB or Grayscale mode. After removing gradients, you can then convert back to the desired image mode.

Basics

GradientXTerminator works by using the selected portions of an image to estimate the background gradients. A mathematical model known is constructed based on these portions of the image. Think of this process as bending a "rubber sheet" so that it follows the brightness gradients in the background, but not the brightness of the objects in the image. This model allows the plug-in to estimate the pixel values of the background gradient in the unselected portions of the image, including parts of the image with brighter foreground objects such as galaxies, nebulas, and star clusters.

How well GradientXTerminator corrects for the background gradients in an image depends mainly on the accuracy of the input you give it. Fortunately, the rich set of selection tools in Photoshop make selecting the background easy.

Background Selection

There are at least three approaches that work well for selecting the background of an image:

Lasso Tool

Using Photoshop's Lasso tool, you can approach background selection in a sort of a backwards fashion. Rather than trying to lasso all of the background areas of an image, you can first select all of the foreground (object) areas, and then invert the selection. See the tutorial for an example of this.

Magic Wand

The Magic Wand tool, if set up properly, is very effective at selecting background regions while including very little if any object areas. The key setting for the Magic Wand is "Tolerance." This controls how wide a range of pixel values the tool will consider equivalent to the part of the image you click on. A larger tolerance means more of the image will be included. A small tolerance means less will be included.

Generally, a value of between 5 and 10 works well for the Magic Wand's tolerance. If you find that the current setting tends to select too much object in addition to background, try lowering the tolerance value. If only part of the background gets selected, try raising the value.

As shown in the tutorial, you can also use the Shift and Alt keys with the Magic Wand. Holding down Shift while clicking on the image with the Magic Wand will cause the area you click on to be added to the selection. Holding down Alt, on the other hand, will cause the area to be removed from the selection.

Select Color Range

This function is accessed in Photoshop using the menu: Select->Color Range. If you have invoked this, you will notice that the cursor turns into a little eyedropper if you pass it over the image. Click on an area of the background. You will notice that much of the image background area in the Color Range dialog box turns white. Adjust the "fuzziness" slider to include more or less of the background as desired. This is analogous to the Tolerance setting of the Magic Wand tool. Try clicking on other parts of the image background with the eyedropper to get the selection you want. Then click OK to select it.

Sometimes, a combination of selection methods is appropriate. See the tutorial for an example of using the Magic Wand in combination with the Lasso tool. With a little practice, you should be able to select the appropriate parts of an image very quickly.

Detail

To extract the background gradient information, GradientXTerminator divides the image into a grid. The fineness of this grid is controlled by the Detail setting. A higher level of detail results in a finer grid.

Which setting to use depends upon the gradients present in your image. A large-scale, slowly varying gradient, such as a linear gradient from light pollution, is easily modeled mathematically and so only needs a coarse grid setting. A more complex gradient, such as that caused by vignetting in the optical system (when not corrected by a flat field calibration), might need a medium detail setting to properly correct. The fine setting would be used for gradients that vary over short distances in the image. Slight imperfections in flat-field calibrations can sometimes cause subtle gradients that are well-corrected using the fine setting.

One trade-off with the detail setting is that the filter will take longer to run with a finer setting; the more grid points there are, the harder it is mathematically to figure out how the rubber sheet bends to conform to them. Also, during the background extraction process, the plug-in has a much easier time of rejecting stars or faint background objects that might be inadvertently selected when the detail setting is on a coarser value.

Detail Settings

Coarse

Medium

Fine

Strength

The Strength setting determines how closely GradientXTerminator follows the extracted background information during the correction process.

Imagine the mathematical model of the background gradient as a sort of rubber sheet that is allowed to bend and flex to fit the gradient information. The Strength setting conrols the stiffness of this imaginary rubber sheet. A low strength is analogous to a very stiff sheet of hard rubber; it can't bend very much to follow small-scale variations in the background level. This setting is appropriate for large-scale gradients that don't have much detail to them, such as linear or near-linear light pollution gradients that span all or most of the image.

A high strength is equivalent to a very flexible sheet of rubber, and can follow small variations in the background level. This is appropriate for final correction of subtle, small-scale gradients.

The higher the strength, the more careful you must be in selecting the background area. If you inadvertently select the faint halo of a galaxy, for example, a high strength setting will likely flatten it right out. Use a low strength setting for your initial large-scale gradient correction, and then a higher setting later if more accurate correction is needed.

Balancing the Background Color

The "Balance background color" checkbox tells GradientXTerminator to adjust each color channel so that the background is an even neutral (grey) tone. This is done on the whole image, after gradient correction has been done. In other words, the background is neutralized by adding or subtracting a constant value to every pixel in the image. This is done for each color channel in the image.

This can be an extremely helpful feature, and should normally be left on for color images. Many images suffer from a color balance problem that can be traced to a background color imbalance. The background balance can be hard to spot, as your attention is probably on the color of the foreground objects. If you correct the background balance, you will probably find it much easier to correct the color of the foreground object.

Checking the Background

Both before and after running GradientXTerminator on an image it can be very helpful to temporarily boost up the background level. This allows you to see any gradients that might be tough to spot otherwise, and also to check how well GradientXTerminator did. Invoke Photoshop's Levels dialog (Image->Adjust->Levels), make sure the Preview checkbox is selected, and slide the midpoint slider to the left while watching the image. Click Cancel to make sure you don't actually apply this change to the image.

Multiple Passes

The best way to handle tough gradient situations is to do multiple passes. First, correct the large-scale gradients using a coarse or medium Detail setting, and a low or medium Strength setting. Then correct the smaller-scale gradients using a medium or fine Detail setting and a medium or high Strength. Remember to do a more accurate job selecting the background when using higher Strength settings.

Correcting for Vignetting

Although GradientXTerminator can easily correct for vignetting in an image, it is more optimum to do so with standard flat-field calibration. The reason is that vignetting is a multiplicative error, which is to say that the vignetted pixels are effectively multiplied by a value that depends on where the pixel is in the image. Pixels further away from the center of the image are multiplied by smaller values, making them dimmer. This is different from gradients caused by light pollution, which are additive in nature. That is, the gradient is caused by light pollution adding values to pixels depending on their position in the image. This is what GradientXTerminator assumes has happened when it is processing an image.

Another way to think about this is that vignetting effectively reduces the sensitivity of the affected pixels, whereas a gradient effectively adds a position-dependent bias to the pixel values.

Flat-field calibration measures and corrects for the vignetting of the optical system, among other things. When a flat is correctly applied, it is divided into the image, properly correcting for the multiplicative errors of vignetting.

 

Revision History

Version Date Comments
1.3.0 5 Dec 2010 Ported plug-in to work in 64-bit mode with Photoshop CS5 on Mac OS X 10.6 (Snow Leopard).
1.2.0 29 Nov 2008 Ported plug-in to work on 64-bit Windows Photoshop installations (XP 64 or Vista 64). Fixed the "strength" parameter reversal on the Mac version.
1.1.4 15 Nov 2008 Fixed a registration bug.
1.1.3 1 June 2008 Made registration email address case-insensitive.
1.1.2 10 May 2008 Changed registration reminder (nag screen) to only show up once per day.
1.1.1 21 April 2008 Fixed registration issue on PowerPC-based Macs.
1.1 20 April 2008 Ported plug-in to work on both Windows and Macintosh computers. Revised licensing system to be more robust (permanent keys will not require re-entry.)
1.01 23 April 2005 Maintenance release:
  1. Now works correctly on layered images.
  2. Disabled the plug-in for images in modes other than RGB and Grayscale.
    (Please convert other images to one of these modes to use the plug-in.)
  3. Now gracefully handles the situation of not having enough background area selected to extract gradient information.
1.00 12 April 2005 Initial Release
The plug-in version number is displayed on the main dialog box in versions 1.1 and later. On earlier versions, to find out which version you have, access the "About" box for GradientXTerminator. In Photoshop, invoke Help->About Plug-In->GradientXTerminator.

Acknowlegements

Thin-plate spline code Copyright ©2003-2005 Jarno Elonen.

DES cryptography code Copyright ©1995-1997 Eric Young.