RBA Premium Astrophotography

Free Tools and Plug-Ins: WhiteCal

About WhiteCal

WhiteCal is a simple Photoshop plug-in that allows you to select an area of an image (a sample), and then it'll do a complete RGB color balance assuming that the average color in the sample is supposed to be white/neutral. The sample can be anything you can select using any of Photoshop's selection tools: marquee/lasso tool, magic wand, color range, etc.

There are several different applications for this plug-in.

One is to do a standard white balance adjustment... Say you took an picture and the colors look odd. If there's an area of the image that you know it should be white (or at least of neutral color), you could select a part of that area, and then use WhiteCal to adjust the colors of the entire image (not just the selection!) so that the average resulting color of the selected area will in fact become white/neutral, and the colors of the rest of the image become adjusted according to the same coefficients applied to make the selected area white/neutral. For astrophotography aficionados, this is very useful for example to do color balance on daylight pictures taken with a modified DSLR camera.

In astrophotography, WhiteCal can also be very useful to do a color balance based on a G2V star: simply select the star (you can use the lasso/magic wand tool for that) and run WhiteCal. Do try to avoid selecting saturated pixels. Some people also like to do the color balance of an image of a galaxy by assuming that the core of the galaxy - or all visible light coming out of the galaxy - is white. Again, simply select the areas you assume their average should be white, run WhiteCal, and the colors of the entire image will be balanced accordingly.


To use WhiteCal you need a computer running Windows (tested on XP, Vista and Windows 7) and Photoshop (tested on CS2, CS3, CS4 and CS5). WhiteCal will likely work under previous versions of Windows and Photoshop but I haven't tested it. If you successfully runWhiteCal  in any of the not-tested versions of Windows and/or Photoshop, let me know

Why not Mac? ... Short answer: because I don't have one, therefore I cannot compile and test the plug-in for the Mac.

Download it

Downloading WhiteCal is easy, simply click one the links below:

For any non-64 bits version of Photoshop: DOWNLOAD WhiteCal

For Photoshop 64 bits ONLY: DOWNLOAD WhiteCal 64bits

By the way, WhiteCal is free (as in "free beer") and I want it to stay that way, so permission is NOT given to include this plug-in in any commercial package. If you downloaded WhiteCal, whether standalone or as a part of a package, and paid for it, please let me know. Having said that, if you find it useful and would like to make a small donation, please use the "Donate" button below. This will entitle you to receive notifications of new upgrades to this plug-in. The Donate button will take you toPayPal - don't worry when you see the donation goes to AR Networks. Yes, that's me.

Installing WhiteCal

Once downloaded, you'll need to unzip the WhiteCal.zip. This will extract the WhiteCal.8bf file.

Once extracted, copy the WhiteCal.8bf file to the Plug-Ins directory in your Photoshop installation.This usually is something like C:\Program Files\Adobe\Adobe Photoshop CS2\Plug-Ins

After you've copied the file to the Plug-Ins directory, start (or restart) Photoshop.

Using WhiteCal

When you're ready to use WhiteCal (you'll need at least one image loaded in Photoshop), first, with the lasso/marquee/magic wand/color range/etc tool select the area you assume to be white/neutral. Once that's done, go to the Filters menu, find the DeepSkyColors menu option, select it, then click on the WhiteCal sub-menu option. If you don't see it there, chances are you did something wrong when you copied the WhiteCal.8bf file, so double-check you indeed copied it to the right directory. Again, don't forget to restart Photoshop anytime you copy a plug-in filter to the Plug-Ins directory so Photoshop knows it's there.

After running WhiteCal, the plug-in will compute the coefficients for the selected area, and present them to you in a window that looks like this:

At that point, you can simply click OK to accept the values WhiteCal has calculated, or if you like, you can enter your own.

What happens if I don't make a selection before running WhiteCal?

WhiteCal will simply assume the area selected is the whole image.

Does WhiteCal work well with saturated areas?

Let's just say that WhiteCal will not complain but the results will not be good. The reason is because right now WhiteCal does not ignore saturated pixels, so they too are taken into account when calculating the offsets. This however will influence the offset values given by WhiteCal.

One of the things in my to-do list is for WhiteCal to detect saturated pixels in the selected area and ignore them when calculating the offset values, and at the same time, being able to determine if the amoof non-saturated pi is large enough to compute acceptable offset values, and complain otherwise.

In the meantime, when you do your selection, please make sure that either the sample (the selected area) has no saturated pixels, or that at least there's a substantial larger amount of non-saturated pixels in it. 

A note about lightness

WhiteCal may affect the lightness of the image, especially in cases where the "correction" is big. This is because the current version of WhiteCal does not save the lightness prior to applying the offset values to the RGB channels. Since the lightness in an RGB image can be extracted from the RGB values (it involves a conversion to CIELab color but we won't get into that now), any changes to any RGB channel - which is what WhiteCal does - will affect the lightness.

In order to preserve the exact lightness as the original image, it is recommended to follow this process:

  • Duplicate the layer where you'd like to apply WhiteCal.
  • Make the blending mode of that new copy to "Color".
  • Apply WhiteCal over that new layer.
  • Merge that new layer back with the original

The above process will adjust for color balance without affecting the lightness at all. Again, for small corrections, you could use WhiteCal directly over your working layer, although in general I do recommend following the method I just described.

Bit depth

WhiteCal should work on images of either 8, 16 or 32 bit depth. If you find that WhiteCal didn't work with your image, again, let me know. Regardless of the bit depth of the image, all calculations done by WhiteCal are done internally in 32 bit floating point mode.

Color Mode

WhiteCal only works well when the image is in RGB mode.  You can still use WhiteCal when you're in Lab or CMYK modes for example - WhiteCal won't complain - but the results will not be what you were expecting. Although this is something WhiteCal should take care of internally - say converting the image to RGB mode internally, and when it's done convert it back to whichever mode it was before - at this point WhiteCal does not check the current color mode being used, and it simply assumes the image is in RGB mode, so you must make sure your image is in RGB mode prior to using WhiteCal.

Also, make sure you didn't go to the Channels palette and select just one channel, or WhiteCal will complain with a "problem with the filter module interface". WhiteCal needs all three channels active in order to work.  

WhiteCal and masks

Because WhiteCal uses a selected area to determine the RGB offsets - and then it applies these offsets to the entire image - you cannot apply WhiteCal to just one area of the image: the selection is being used to define our sample!

Now, if you really need to apply WhiteCal to just one area of the image, you can still do it by creating a duplicate layer, applying WhiteCal to that layer, and then using a mask over that layer to hide/reveal whichever areas you need.