The Milky Way offers some great wide angle views for the astrophotographer. But there is a catch: the dense star field. While in theory stars are point like, ie subpixel sized, in practice the seeing, some worse than ideal transparency, lens errors, bad focus, a not that parallel lens and sensor, a bit of dew – all work against the astrophotographer.
While I can’t solve all the problems, I sure can try. So I wrote a program. I found that I can mitigate some of the problems: the blown up stars, the panda eye image artifact around stars with middle range luminosity and the overall visual impact of the star field. I continued to develop the previous version of my software, so here’s what I’ve got now.
The program
I wrote the program in PHP because it is the language I mainly use. It is not the best choice, by far. But it does the job I expect it to do. All you need is a webserver, some storage space, memory and time. You may download it from here.
Input
0) since my program is only 8 bits for now, it receives an input image that has almost been finished from other points of view (curves, contrast, saturation etc). The program’s star sizes are tuned for what I get with my Canon 1100D mod with the 200 mm lens. YMMV.
1) the program receives an input.jpg file saved with 100% quality. The file run.txt is checked, the program gracefully halts if the file is/goes missing.
No panda eyes, no luminous stars
2) the program identifies pixels above an L luminosity threshold
3) it replaces the identified pixels and their R surroundings with black (that’s 0x000000 in RGB)
4) the program iterates taking the black pixels and if they have non-black surroundings, replaces them with the average of the surroundings, thus progressing from the margin of the black areas until the wounds are healed, producing a healed output z1
No fainter stars
5) the program identifies pixels that are grayish (very low saturation) and more luminous than part of their surroundings by at least D difference – look like tiny stars
6) it replaces the identified pixels and their R surroundings with black
7) execute step 4), producing a healed output z3
Stages, outputs
There are many stages saved, like after step 3 and step 6, many during step 4 and step 7. These are useful to see the progress.
Outputs are created as follows, italic marks interesting items. Further down I’ll reference these outputs as zX:
output_z1_healed.jpg – luminous stars prone to panda eyes are removed and the picture is healed (saved after step 4)
output_z2_no_faint_stars.jpg – from the previous, faint stars are removed (saved after step 6)
output_z3_healed.jpg – the previous healed, saved after step 7
output_z4_lighter_parts_blur_00.jpg – made of pixels where the original is lighter than z3 – mainly as a curiosity
output_z4_lighter_parts_blur_10.jpg – the previous, blurred – mainly as a curiosity
output_z5_max_of_z3_and_input.jpg – the maximum of the original and z3 – panda eyes are hidden
output_z6_the_healed_with_curve_premerger.jpg – a nearly linear light curve applied to z3, which has no stars
output_z6_the_starry_with_curve_premerger.jpg – an exponential light curve applied to z5, which has all the stars but no panda eyes, with a slight gaussian blur
output_z7_merged.jpg – the previous two added
Outputs of interest
Depending on your taste and image editing software, you can use many of the outputs, the goal being to tune down the stars without affecting the nebulosities, be they light or dark or the magnitude order of stars (if star a is fainter than or as luminous as star b in the input picture, this relation must remain true for the output too, although with very faint grain like stars there is an issue that I chose to ignore).
The main output is z3 – the version from which almost all the stars have been removed and the holes are healed. Sometimes I use z7, sometimes I only use z3 as a layer in the editor, and progress toward something like z7 inside the editor using layers and curves.





