How to improve your astro images ...

22 replies2.1k views
Mike Cranfield avatar
Anyone who has dabbled in astrophotography will know, the move from your dark linear image to a stretched image which shows all that wonderful detail you have spent hours capturing, is a critical step in producing a fine finished product.

As a step towards simplifying this dark art of stretching images for as wide an audience as possible, I have been working with a fellow Astrobin member, Dave Payne, to develop a Pixinsight script that provides a complete integrated environment to define, analyse and apply stretches.  In addition to the familiar Histogram Transformation and Arcsinh stretches, we have included a new stretch type "Generalised Hyperbolic Stretches" which Dave first proposed in an Astrobin Forum Post in October.  

Accompanying the script is a comprehensive primer covering both functional use of the script and also some really helpful practical pointers on how to get the very best out of your own images.

The script and documentation can be downloaded at the following link

https://github.com/mikec1485/GHS/releases

If you are a Pixinsight user we would encourage you to give the script a try and see what you think.  If you do use it please let us know any feedback.  All feedback will be very welcome.

Dave's initial Forum post can be found here: https://www.astrobin.com/forum/c/astrophotography/deep-sky-processing-techniques/alternative-image-stretching-for-mathematically-bent-pixinsight-users-from-linear-to-non-linear-quicker-easier-and-better/
Well Written Helpful Engaging Supportive
David Nozadze avatar
Hello Mike!

Thank you so much for sharing this script! 

Clear skies

D
Gernot Schreider avatar
@Mike 

Thank you for developing and sharing the script. I will definitely try it out and I am eager to learn about stretching.

CS
Gernot
Well Written Respectful
kuechlew avatar
Thanks a lot, as a newbie in AP I won't be the best tester but for sure I'll give it a try. 

Best regards
Wolfgang
David Payne avatar
One of the first things I wanted to do upon the release of the script, was to re-process some older images of mine that I though the script would allow me to do a "better" job on.   My first choice was of SH2-155, The Cave Nebula.    The original was stretched primarily with the CT (Curves) process, and my notes have me being very careful on the star -stretch -> https://www.astrobin.com/w0ojfx/0/?r=0    Using the script, I was able to attain better stars, and at the same time, really bring out the background nebulosity, particularly towards the top of the image.   In addition, the nebulosity on the RHS of the image looks more three dimensional now ->  https://www.astrobin.com/w0ojfx/B/?r=0    As an added bonus, the actual stretch took far less time the second time around.

Clear Skies!
Dave
Helpful Engaging Supportive
Mike Cranfield avatar
David Payne:
One of the first things I wanted to do upon the release of the script, was to re-process some older images of mine that I though the script would allow me to do a "better" job on.   My first choice was of SH2-155, The Cave Nebula.    The original was stretched primarily with the CT (Curves) process, and my notes have me being very careful on the star -stretch -> https://www.astrobin.com/w0ojfx/0/?r=0    Using the script, I was able to attain better stars, and at the same time, really bring out the background nebulosity, particularly towards the top of the image.   In addition, the nebulosity on the RHS of the image looks more three dimensional now ->  https://www.astrobin.com/w0ojfx/B/?r=0    As an added bonus, the actual stretch took far less time the second time around.

Clear Skies!
Dave

A very nice image Dave - and a good demonstration of how the GHS script can help!
Well Written Respectful Supportive
David Payne avatar
I've just have to promote the use of this script.  It just keeps improving my images.  For the Pleiades, I was really able to target the Merope nebula while really controlling the stars and their halos.   https://www.astrobin.com/sn56r7/    Strongly focus the stretch just behind the histogram peak, execute and even faint nebulosity comes alive while keeping the stars safe.
Mike Cranfield avatar
David Payne:
I've just have to promote the use of this script.  It just keeps improving my images.  For the Pleiades, I was really able to target the Merope nebula while really controlling the stars and their halos.   https://www.astrobin.com/sn56r7/    Strongly focus the stretch just behind the histogram peak, execute and even faint nebulosity comes alive while keeping the stars safe.

Hi Dave - this is a cracking image of a difficult subject.  You have really kept those stars nice and tight while revealing loads of that wonderful nebulosity.  Another nice win for the GHS script!
Well Written Respectful Engaging Supportive
Stuart Taylor avatar
I don't suppose some clever and helpful soul would be able to make a similar script for SiriL?
Well Written Respectful
Dale Penkala avatar
David Payne:
One of the first things I wanted to do upon the release of the script, was to re-process some older images of mine that I though the script would allow me to do a "better" job on.   My first choice was of SH2-155, The Cave Nebula.    The original was stretched primarily with the CT (Curves) process, and my notes have me being very careful on the star -stretch -> https://www.astrobin.com/w0ojfx/0/?r=0    Using the script, I was able to attain better stars, and at the same time, really bring out the background nebulosity, particularly towards the top of the image.   In addition, the nebulosity on the RHS of the image looks more three dimensional now ->  https://www.astrobin.com/w0ojfx/B/?r=0    As an added bonus, the actual stretch took far less time the second time around.

Clear Skies!
Dave

There is quite a difference between the 2 images David. I’ve been seriously considering purchasing PI but have been concerned about my computing power. If I decide to give it a try I’ll give your script a go.

Thanks for sharing your script!

Dale
Well Written Respectful
Mike Cranfield avatar
Dale Penkala:
David Payne:
One of the first things I wanted to do upon the release of the script, was to re-process some older images of mine that I though the script would allow me to do a "better" job on.   My first choice was of SH2-155, The Cave Nebula.    The original was stretched primarily with the CT (Curves) process, and my notes have me being very careful on the star -stretch -> https://www.astrobin.com/w0ojfx/0/?r=0    Using the script, I was able to attain better stars, and at the same time, really bring out the background nebulosity, particularly towards the top of the image.   In addition, the nebulosity on the RHS of the image looks more three dimensional now ->  https://www.astrobin.com/w0ojfx/B/?r=0    As an added bonus, the actual stretch took far less time the second time around.

Clear Skies!
Dave

There is quite a difference between the 2 images David. I’ve been seriously considering purchasing PI but have been concerned about my computing power. If I decide to give it a try I’ll give your script a go.

Thanks for sharing your script!

Dale

Hi Dale - you are probably already aware but PI will give you a one month trial licence for free.  That would enable you to make sure that it works Ok with your computing power before laying out any money.
Helpful Concise
Dale Penkala avatar
Hi Mike, yes I am, and I plan to use it, but before I download it I want to have a good idea on what to expect as well as get familiar with the canvas and how some tools are found and used, so I've been watching some YouTube videos for "beginners" or knobs like me. smile

Dale
kuechlew avatar
When I tried to use it yesterday I received an error that a recursive call of the script is not allowed. Since it was just a quick test and I'm still inexperienced in PI maybe I did something wrong - the famous 40 inch problem where you have to look for the mistake within 40 inch distance of the monitor :-)

I'm using version 1.8.8-11-20212235-c, so if anyone can confirm that he/she got the script to run with this version, I know for sure that it's me …

Will have more time to look into it next week.

Best regards
Wolfgang
Mike Cranfield avatar
When I tried to use it yesterday I received an error that a recursive call of the script is not allowed. Since it was just a quick test and I'm still inexperienced in PI maybe I did something wrong - the famous 40 inch problem where you have to look for the mistake within 40 inch distance of the monitor :-)

I'm using version 1.8.8-11-20212235-c, so if anyone can confirm that he/she got the script to run with this version, I know for sure that it's me ...

Will have more time to look into it next week.

Best regards
Wolfgang

Hi Wolfgang

Did you try to execute by dragging the instance triangle across to the image you wanted to stretch?  

If so, I'm afraid this is not possible and you will get the recursive error you have seen.  This is a limitation of scripts vs processes in Pixinsight.  You will need to make sure you have selected the target image you want to stretch and then click the green tick to execute.  

What you can do is define a stretch and then drag the instance triangle to the workspace to create an instance of the stretch.  You can then drag from the workspace to an image to execute.  
CS

Mike
Helpful Concise Supportive
kuechlew avatar
Thank you Mike, this is exactly what I did wrong.

Best regards
Wolfgang
Well Written Respectful
David Payne avatar
Admittedly, the primer is a bit of a book, so I thought I'd write something to get started with the GHS script…

For most deep sky, you just need fix three parameters to design the initial stretch, using the histogram as a guide.  Put the focus point (SP) between where the histogram just leaves the bottom axis and the histogram peak, ie. to the left of the histogram peak.   You will have to zoom in on the LHS of the histogram to pick this point and you will end up with a low value (<0.01, 0.001? maybe even 0.0001)   This is where you will want to add the most contrast.  Set the local stress intensity (degree of focus, b) value between 5 and 10 (you need a high degree of focus for the initial stretch, because most of the data is tight in the histogram peak - try 10!), then adjust D (the stretch amount) to put the stretched histogram peak somewhere about 1/5 to 1/4 of the way across to the right (you will have to zoom out of the histogram again) and then preview or execute!

Now, the Pixinsight HT process only requires you to adjust one slider (the middle one) to control the amount of stretch, while the GHS script asks you to adjust three parameters, this is what allows you to "tailor, or design" the stretch for your image.   Behind HT/STF is a great all-round stretching function, but is an "off the rack" fit.     Setting three parameters should not be too onerous, we hope, and once  you get the "knack" of it….   If you look at your stars in the stretched image, I would bet that they are less impacted by the stretch (more Gaussian in shape, less bloated) and dimmer nebulosity has been made visible.  Do you like it?

If you want to further adjust the stretch, I suggest trying a different SP (only fine edits of approx. 0.0001 are likely needed), you will see how this transforms the resultant histogram - you likely want the resultant to be as wide as possible.   When changing SP look for a wider histogram result, with less shift to the right or back to the left.    b (and D) will be too large if the peak separates into two peaks, but other than that, go for the maximum focus and stretch amount to taste.   Use the histogram result  and image previews as your guide, and then execute again.   In a couple of tries you would have mastered this important initial stretch.

You may then want to adjust the black point - this is deliberately put as a separate step in the GHS - using the linear stretch selection, which will end up shifting the histogram somewhat to the left again, dimming the background.

Finally you can manipulate the stretch further (using smaller b and D factors) to make the stretch focus and amount less.

Hope this helps.
Helpful
David Payne avatar
Here is a half hour video tutorial on getting started with the GHS script.   It was taken from a Zoom meeting where I was showing some fellow members of my local centre (Victoria) of RASC how to get started.  I have put the video on Youtube.  Please excuse the videography and elementary editing.

https://youtu.be/ke5B8XQBwVc

I hope this helps.
Thanks,
Dave
Well Written Helpful Supportive
David Payne avatar
Here is a half hour video tutorial on getting started with the GHS script.   It was taken from a Zoom meeting where I was showing some fellow members of my local centre (Victoria) of RASC how to get started.  I have put the video on Youtube.  Please excuse the videography and elementary editing.

https://youtu.be/ke5B8XQBwVc

I hope this helps.
Dave
Well Written Helpful
guitarmaker avatar
Wow! Thanks Dave for an incredible breakthrough improvement to linear stretching in PixInsight. GHS is a real achievement for us all. Could it be incorporated directly into PixInsight sometime soon without all the downloading and installation effort? Realtime preview would be welcome…
Well Written Respectful Supportive
kuechlew avatar
Wow! Thanks Dave for an incredible breakthrough improvement to linear stretching in PixInsight. GHS is a real achievement for us all. Could it be incorporated directly into PixInsight sometime soon without all the downloading and installation effort? Realtime preview would be welcome...

The script just helped me to win the Telescope Live Observation Bundle Contest for January in the beginner category: And the January 2022 contest winners are.... | Telescope Live
While there is no explanation of the jury what criteria led them to their decision, a look at the images of my fellow contributors clearly reveals that due to the script I kept better control of the high contrast of the galaxy centre as well as the bright stars. This script will remain permanent part of my workflow, it's really fantastic. Thank you Dave and Mike!

Clear skies
Wolfgang
Respectful Supportive
Mike Cranfield avatar
Wow! Thanks Dave for an incredible breakthrough improvement to linear stretching in PixInsight. GHS is a real achievement for us all. Could it be incorporated directly into PixInsight sometime soon without all the downloading and installation effort? Realtime preview would be welcome...

The script just helped me to win the Telescope Live Observation Bundle Contest for January in the beginner category: And the January 2022 contest winners are.... | Telescope Live
While there is no explanation of the jury what criteria led them to their decision, a look at the images of my fellow contributors clearly reveals that due to the script I kept better control of the high contrast of the galaxy centre as well as the bright stars. This script will remain permanent part of my workflow, it's really fantastic. Thank you Dave and Mike!

Clear skies
Wolfgang

Very well done and richly deserved Wolfgang. I am glad GHS helped but the kudos for this win is all yours! 🍾
Well Written Respectful Supportive
David Payne avatar
Wow! Thanks Dave for an incredible breakthrough improvement to linear stretching in PixInsight. GHS is a real achievement for us all. Could it be incorporated directly into PixInsight sometime soon without all the downloading and installation effort? Realtime preview would be welcome...

Thanks guitarmaker. I'm very glad it helps. 

I really appreciate the completement.  I would be remiss, however, if I didn't point out that this was very much a joint effort between myself and Mike.   While the original concept of using these equations was mine, it was actually Mike's clever and hard work that made it work and accessible. 

I too would love to see it distributed within PixInsight.  I did post a link within the Pixinsight forumand also a link within ABS website to shamelessly promote the script, just because I like it too.   I have heard that the Pixinsight folks were busy with a lot of things and neither Mike nor I have an in with them.   However,  the more of us that ask...
Respectful Supportive
David Payne avatar
Wow! Thanks Dave for an incredible breakthrough improvement to linear stretching in PixInsight. GHS is a real achievement for us all. Could it be incorporated directly into PixInsight sometime soon without all the downloading and installation effort? Realtime preview would be welcome...

The script just helped me to win the Telescope Live Observation Bundle Contest for January in the beginner category: And the January 2022 contest winners are.... | Telescope Live
While there is no explanation of the jury what criteria led them to their decision, a look at the images of my fellow contributors clearly reveals that due to the script I kept better control of the high contrast of the galaxy centre as well as the bright stars. This script will remain permanent part of my workflow, it's really fantastic. Thank you Dave and Mike!

Clear skies
Wolfgangv

Superb image and Congratulations Wolfgang! 

I should mention that @Mike  is taking the suggestions that you and others are making to heart and is busy making the script even easier to use and with greater functionality, so please stay tuned...
Well Written Respectful Supportive