# "Unscreening" and re-screening: recombining stars with starless images

#### rcroman

##### Well-known member
Here is a new (and simple) method to extract and recombine stars with starless images that retains star color and brightness. If you've played around much with removing stars, processing the starless image separately, and then trying to recombine the stars with it, you may have run into difficulties that this method can solve.

First, an original image. This is a section of M20, chosen because it has bright and dim nebula areas, and yellow/orange and blue stars in both regions:

Removing the stars with whatever your favorite tool is, we get:

If we create an image of just the stars by the usual method of subtracting the two images above, we get:

The stars on the right are heavily mis-colored because we subtracted the nebula color that was “behind” them. They are also “weak” – they do not progress to full brightness in their cores – since they had moderately bright pixel values subtracted from them. This is fine if all we want to do is add the stars back to the starless image – this is just reversing the subtraction and works fine. But if we alter the starless image and then do this, we often run into trouble.

For the sake of discussion, let’s assume that we want to add these stars back into the starless image, but with them horizontally flipped. This is of course quite perverse in an astronomical sense, but it illustrates the point. We get this:

The stars on the left are the wrong color, and additionally they are weak and transparent. The stars on the right are also the wrong color, and moreover they are heavily clipped in their cores. We could try to fix the clipping by rescaling the star image, but then the stars on the left would get even weaker.

Now for the proposed approach of “unscreening” and re-screening. We get the unscreened stars using the following expression in PixelMath:

~((~original)/(~starless))

This is just an algebraic rearrangement of the well-known screen blending function. It is mathematically ill-conditioned in that it involves a division with a divisor that can approach or equal zero, but PixelMath handles this nicely:

The star colors are now correct, or at least much more so, and they also have full brightness in their cores. Now if we re-screen a flipped version of these stars onto the starless image, we get this:

Blue stars remain blue, and yellow stars remain yellow. It’s not perfect in that the halos around the stars on the left are truncated since they came from a bright area, but this is an extreme example… we wouldn’t usually add stars back in with their positions completely changed like this.

A comment on the bright blue star on the right: its halo has taken on a magenta color. But this is correct! A blue star in front of a red nebula will have magenta chrominance in the halo since we are detecting light from both the halo and the nebula in these pixels. This is in fact what the screen blending mode was originally developed to achieve: an approximation of the mixing of light.

Here is another example: let’s say we want to combine RGB stars with a narrowband nebula image. Here are M20’s stars from above combined with a starless image of a portion of NGC6188 using the add-subtracted-stars method. This is again astronomically perverse, but illustrative. I chose the positioning of the stars strategically to show the issues:

The bright blue and yellow stars in the upper right are very clipped, and the stars on the left are again weak and have the wrong color.

Here is the same using the screen-unscreened-stars method:

Again we see that star color and brightness are retained.

A perhaps more common example is to simply de-emphasize the stars using a gamma adjustment to the star image. If we do this using the subtracted stars and then add them back into the starless image, we get this:

The stars have become weak and transparent, and their colors have shifted due to the nebulosity behind them.

Here is the result of doing the same gamma adjustment on the unscreened stars, then re-screening onto the starless image:

Hope this is useful... it's saved me a lot of time in processing.

Great post Russell as usual! Clear explanation and excellent examples.
Thank you for sharing this.

Roberto

I got a bit confused. This discussion basically supports the one pixmath expression of ~((~original)/(~starless)) which is being labelled as the "screen-unscreened-stars method"?
Just trying to clarify the discussion.
It looks really good and if we get enough clear skies, I'm keen to try it

That expression is the one to use to generate the stars-only image from the original and starless images. To re-screen the stars back onto the (perhaps further processed) starless image, it is:

~((~starless)*(~stars))

or, since op_screen() has been added to PixelMath:

combine(starless, stars, op_screen())

Last edited:
This works very well and avoids the washed-out stars.

That expression is the one to use to generate the stars-only image from the original and starless images. To re-screen the stars back onto the (perhaps further processed) starless image, it is:

~((~starless)*(~stars))

or, since op_screen() has been added to PixelMath:

combine(starless, stars, op_screen())
I believe this is the same to recombining the unscreened stars image and starless image in Photoshop using "screen" blending option?

Correct... the screen blending mode in Photoshop performs the same operation.

nice, I have been using the screen blending mode to combine processed starless and stars images in PS for the added flexibility of the layers as a final step of my processing, and I noticed the dimmer and sometimes washed out stars. I kind of fixed it by boosting the brightness of the star layer but of course it only partially addressed the problem. I will try this method soon, thank you for sharing!

Hello Russell, thank you for your suggestion!

I studied your un-/rescreening method, but it seems that this method works well on RGB (OSC) images.
How do you proceed with three monochrome images of stars (R, G, B) to integrate them on an HSO image?
I tried to treat individually each linear image R, then G, ... with BTX to decrease the stars-size, then combine them with ChannelComb, then strech: the stars are no longer round.
Then I tried to combine the linear images into a linear RGB image, and process it afterwards with BTX - when I stretch the image, the stars are no longer round.
And I think that BTX on an non-linear image of (only) stars doesn't work.
How to do ? An idea ?

Russell, @rcroman

I would like to use this opportunity to thank you for all the effort you put into your AI-based tools - I am gladly using these with amazing results!
Thank you so much!

Your above explanations are the icing on the cake - this is indeed very helpfull!
I too struggled with adding back the stars in a way that retained star colors and core brightness.
After all, it was not about how you add back the stars, but how you extract them in the first place!

Again - thanks very much!
Chris Koll from Austria, Europe

Russell, @rcroman

I would like to use this opportunity to thank you for all the effort you put into your AI-based tools - I am gladly using these with amazing results!
Thank you so much!

Your above explanations are the icing on the cake - this is indeed very helpfull!
I too struggled with adding back the stars in a way that retained star colors and core brightness.
After all, it was not about how you add back the stars, but how you extract them in the first place!

Again - thanks very much!
Chris Koll from Austria, Europe
Hi Chris. Thanks very much for your kind words.