A common problem in astronomical image processing is dealing with stars. Sometimes you need to adjust the stars in your image separately from your image’s subject and it would be useful to select only the stars in your image so that you could apply an adjustment layer, for example.

When dealing with an image that’s made up of mostly black background, selecting the stars is actually pretty easy in Photoshop or Photopea. You just use Select – Color Range and select the background color. Once you have that, from the menu use Select – Inverse to select the stars and you’re set.

The problem comes when you have stars among your image’s subject. Take for example this image of IC 1795:

This image has stars among the nebula and for some reason, all of the stars have a blue cast to them. You could try to remove the color gradient from the image by following these directions: Remove A Soft Color Gradient From Your Images, but that leaves you with an image like this:

The nebula has lost contrast and the stars are still blue.

The solution is to select just the stars using some adjustments in Photopea or Photoshop.

This is what the final adjusted image looks like:

The stars are no longer blue and the nebula is a deeper red, without affecting the color cast of the stars.

Selecting Stars Located Within a Nebula or Other Target

I assume you’re using Photopea at  https://www.photopea.com/ but you can also use these directions in Photoshop too.

You can download the sample original and final images here for you to try this technique.

Start by opening the image: select File Open and locate your image

Right-click the Background layer in the layers panel at the bottom right side and select Duplicate Layer as shown:

We’re going to make a couple of adjustments to subtract one part of the image from the complete image, revealing just the stars. Once we have just the stars, we’ll select them so that we can manipulate them independently from the rest of the image.

From the menu select Filter – Dust and Scratches

Adjust the top slider until you can’t see the stars in the preview image anymore. Your image will change dramatically, but that’s expected. Move the slider slowly until you see that all of the stars are gone, as shown in the following screenshot:

Once all of the stars are gone, move the lower slider until you see your image looks relatively normal – there shouldn’t be any blurriness or distortions. Your stars will come back but slightly darker – this is normal and expected, as shown in the following screenshot:

Go to the Layers panel and locate the word “Normal” and click the arrow next to it. This is the blending mode – the way Photopea blends one or more layers. Select Subtract from the menu as shown:

The screen changes to mostly black with the stars on it. We have now isolated the stars from the rest of the image.

Now select the areas between the stars and then invert your selection to select just the stars.

From the menu, choose Select – Color Range

Set the value of the Fuzziness parameter to about 40, click Replace, and then click a black area in the image. Your screen should look something like the following:

Click Ok to make the selection. Now the background is selected, to select the stars, from the menu, choose Select – Inverse – your screen will look something like the following:

Click the eye icon next to the Background copy layer to hide it since we don’t need it anymore.

Adjusting Only The Stars In Your Image

Click the name of the Background layer to activate it.

Now you have the stars on your main image selected – you can apply a Curves adjustment to reduce the blue cast on just the stars.

From the menu, select Layer – New Adjustment Layer – Curves

When you do this, your selection gets saved so that the Curves adjustment only affects the selected stars.

Click the arrow next to where it says RGB in the new window that came up, and select Blue.

Adjust the blue so  that your adjustment is similar to the following:

Now your stars are less blue.

Let’s adjust the Hue/Saturation of the nebula. From the menu choose Select – Inverse to select the nebula.

From the menu select Layer – New Adjustment Layer – Hue/Saturation and set the Saturation to about 40:

From the menu, choose Select –  Deselect, or press CTRL + D. This is your final adjusted image. You can save your image as a PSD to retain your layers and adjustments in case you want to change them later.

Conclusion

You learned one technique for selecting the stars in your image and editing them independently of the target that contains the stars.

Update: StarNet++ is an easy to use, one-step method for removing stars from your images. It uses artificial intelligence to remove stars and replace them based on the content of the surrounding area. Check out the article about using StarNet++ here.