Home > Uncategorized > TUTORIAL: How to eliminate star halos in PixInsight

TUTORIAL: How to eliminate star halos in PixInsight

Bright stars next to dim deep-sky objects are one of the more challenging issues to deal with when processing an image, especially when there are reflection halos off a filter.  This is especially true with narrowband imaging, where we are stretching the image aggressively.  This can make what would otherwise be an inconspicuous reflection look like a giant circle drawn over your image.  The most common example is Alnitak when imaging the Horsehead Nebula, but this issue crops up in other objects.  In this case, with Gamma Cassiopeia when trying to image IC59 and IC63.

Here is one quick way to address this with PixInsight’s PixelMath process.  There are several other tutorials online that describe a similar approach, but they seemed needlessly complex, so I’ve written up what I think is a faster way to do it.

Here is our offending image, an H-alpha image of IC59/IC63 with Gamma Cass lighting up the whole center area.

Gamma Cass 1

Here are the steps we’ll follow:

  1. Get the left, right, top, and bottom values of the halo.
  2. Clone the image and tell PixelMath to generate a mask from the clone.
  3. Blue the mask.
  4. Apply the mask to our original image, and use HistogramTransformation to remove the halo.


We just need to get four numbers:  the X values for the left and right edges of the halo and the Y values for the top and bottom.  In PixInsight, you can move the cursor to the appropriate spot and read these values from the bottom panel.  In the image below, you can see that the left edge has an X value of about 1928.

Gamma Cass 2


First, clone your image by dragging the image identifier tab on the left side to anywhere on the workspace.  Now we’re going to use PixelMath to create a mask for the halo with these four numbers in one step.  Here’s the formula to enter on the RGB/K line:

iif(sqrt((x()-(R+L)/2)^2 + (y()-(B+T)/2)^2) < (R-L)/2, 1, 0)

This is just an application of the formula for a circle to an IIF statement that turns the pixel white if it’s within this circle and black if it’s not. From the quick measurements I took above, I can enter the left, right, top, and bottom values on the Symbols line.  Your values will differ depending on your image, but you just need to assign them each to their appropriate letter symbol:

L=1928, R=3342, T=912, B=2334

It should look like this:

Gamma Cass PM

Apply this process to your cloned image, and you should get a mask that looks something like this.

Gamma Cass mask1


As with any mask, it needs to have softer edges, to open up the Convolution process and apply a little blur.  In this case, I’ll try a Std Dev of 20 pixels.

Gamma Cass mask2

Much better.


Now apply the mask to the original image by dragging the image identifier tab on the left up to the original image’s gray bar on the left (or you can use the menu options if that’s what you’re used to).  Leave the mask enabled, but unclick  the “Show Mask” button so you can see what your doing.  Open the HistogramTransformation process and click the check mark so it’s tracking the currently active view.  Now, open the Real-Time Preview by clicking the little circle at the bottom of the process.  Drag the black point slider to the right until the halo disappears.  Apply to the image once you are happy with the setting.  That’s it!

Gamma Cass HT

In this case, here’s the final image:

Gamma Cass Result

If the mask was off center or needs to be adjusted, you can undo and go back to tweak your values, especially the amount of blur that needs to be applied.  If you have inner halos due to other reflections, you can just repeat the process using their coordinates.

The ‘puckered’ halo around Gamma Cass above is an artifact of the microlenses on the sensor… alas there is not a simple solution for these other than layering in data from a shorted exposure or directly editing the area in another image processing tool.


Categories: Uncategorized
  1. matthew_carlos
    November 2, 2019 at 12:45 pm

    what if star is too bright, the same one you are masking here for halo. How can I dim it a bit so that it isn’t over powering the “ghost”

  2. November 2, 2019 at 2:45 pm

    This is a difficult processing challenge, and there are several options. In general, you make a smaller mask for the star (blurred/feathered of course), then run HistogramTransformation and slide the midpoint slider to the right. You can also use Curves. It’s going to depend on the image and how big/bright the core star is. Another option is to blend in data from a shorter exposure, which is more complicated because you have to match the background brightness.

  3. Jose Hugas Pannon
    December 30, 2019 at 2:28 pm

    Hola el pixel mat me dice que no encuentra la imagen clonada,image not found,podrias decirme cual es mi fallo.
    Gracias ,saludos.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: