Update: See
post #8 below. I've tweaked the formula specifically for magenta now, and updated the zip file with process icon below. Just download the zip file, unzip somewhere safe and memorable (My Documents/PixInsight or something like that). In PixInsight, choose "Load process icons" and browse to that xpsm file you unzipped. The magenta_reduction PixelMath process icon should appear on the PI desktop, and you can just drag and drop that on your image.
R: $T[0]
G: iif(min($T[0],$T[2])>$T[1],min($T[0],$T[2]),$T[1])
B: $T[2]
-----------------------
Not sure if this has been done before, but I had this idea recently on how to get rid of the magenta stars in SHO narrowband images due to the red SII and blue OIII channels needing to be stretched so much to balance strong G Ha. A common Photoshop method I've seen is to do a selection based on colour (magenta), and desaturate it.
It occurred to me that with PixelMath we may be able to achieve something like this. We could detect if a pixel is magenta by checking if it's R and B channels were of similar value (within some acceptable range), and if they both were significantly brighter than the G channel.
With this in mind, I came up with the following formulae. I found some stars needed a luminance rule in there too.
R: $T[0]
G: iif((CIEL($T)>MIN_BRIGHTNESS)||((mi n($T[0],$T[2])/(max($T[0],$T[2])>MAGENTA_DEFN))&&(mean($T[0],$T[2])>$T[1])),mean($T[0],$T[2]),$T[1])
B: $T[2]
Symbols: MAGENTA_DEFN = 0.9, MIN_BRIGHTNESS = 0.9
Attached are some sample before and after images (not my images, but have sought the approval of the image owners where possible. Some were from a Google image search). Seems to work ok to me. Thoughts? Any improvements or suggestions on the above?
I'm just hoping it is a quick and simple solution to what seems to be a common issue with narrowband images. Just drag and drop the attached process icon on your final narrowband image with magenta stars and they're gone.