Jump to content

SkySurveyBanner.jpg.21855908fce40597655603b6c9af720d.jpg

Colour Preserving Stretch in Photoshop


Recommended Posts

Thanks everyone for your feedback - it's helped me to crystallise the way this should work.  To be honest I found using a gamma curve was just a bit too fierce for what I wanted. So with a bit of maths, I've now managed to find a way to actually use Arcsinh (Hyperbolic Arcsine) curves in Photoshop :) 

Firstly a couple of hints:

  • Always perform a levels adjustment on your image to subtract as much of the background as possible otherwise you won't achieve so much stretch and the colours you see in your stretched result will be the same colours (washed out by the background) that you started with.
  • If you are planning to use the colour preserving stretch frequently then it's well worth recording an action to create the layers for you.

I have worked out that it is possible to design preset curves that apply an Arcsinh curve.  However Photoshop doesn't have the granularity in the curve design to allow such a strong curve to be designed in one hit.  Therefore I have designed a curve that when applied twice in succession gives the correct Arcsinh shape.  Here's an example:

PS_Arcsinh_Curve.jpg.097d951c5cc4b48be5796a34d7366b7b.jpg

The above curve is not an Arcsinh curve of itself but will give an Arcsinh curve with a stretch factor of 300 when applied twice in succession.  Every single point on the curve has been carefully calculated in a spreadsheet to have the desired effect.  The way it is used is illustrated below:

PS_Arcsinh_Layers.jpg.ee78e2632f5c00368ef423fdeb847645.jpg

The intermediate Levels layer is there to allow some additional subtraction of background (if necessary) between the first and second curve layers.

I have calculated and built a set of preset curves: Arcsinh10, Arcsinh30, Arcsinh100, Arcsinh300, Arcsinh1000 which give stretch factors of 10x, 30x, 100x, 300x, 1000x.  Arcsinh100 is probably the most useful one in general.  You would use the same Arcsinh100 preset curve in both layers to achieve a stretch of 100x.  It is quite possible to "mix and match" them - for instance using Arcsinh100 in one layer and Arcsinh300 in the other layer would give a stretch somewhere between 100x and 300x.

If you want to use these curve I'm making them freely available here: PS_ArcsinhCurves.zip

You need to unzip them into the relevant Photoshop folder.  On my Windows machine that is C:\Users\Mark\AppData\Roaming\Adobe\Adobe Photoshop CC 2015\Presets\Curves  but if you don't know where your own folder is, just try to save any arbitrary curve as a preset and notice which folder Photoshop is using.

Enjoy!

Mark

Edited by sharkmelley
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

19 minutes ago, sharkmelley said:

Thanks everyone for your feedback - it's helped me to crystallise the way this should work.  To be honest I found using a gamma curve was just a bit too fierce for what I wanted. So with a bit of maths, I've now managed to find a way to actually use Arcsinh (Hyperbolic Arcsine) curves in Photoshop :) 

Firstly a couple of hints:

  • Always perform a levels adjustment on your image to subtract as much of the background as possible otherwise you won't achieve so much stretch and the colours you see in your stretched result will be the same colours (washed out by the background) that you started with.
  • If you are planning to use the colour preserving stretch frequently then it's well worth recording an action to create the layers for you.

I have worked out that it is possible to design preset curves that apply an Arcsinh curve.  However Photoshop doesn't have the granularity in the curve design to allow such a strong curve to be designed in one hit.  Therefore I have designed a curve that when applied twice in succession gives the correct Arcsinh shape.  Here's an example:

PS_Arcsinh_Curve.jpg.097d951c5cc4b48be5796a34d7366b7b.jpg

The above curve is not an Arcsinh curve of itself but will give an Arcsinh curve with a stretch factor of 300 when applied twice in succession.  Every single point on the curve has been carefully calculated to have the desired effect.  The way it is used is illustrated below:

PS_Arcsinh_Layers.jpg.ee78e2632f5c00368ef423fdeb847645.jpg

The intermediate Levels layer is there to allow some additional subtraction of background (if necessary) between the first and second curve layers.

I have calculated and built an set of preset curves: Arcsinh10, Arcsinh30, Arcsinh100, Arcsinh300, Arcsinh1000 which give stretch factors of 10x, 30x, 100x, 300x, 1000x.  Arcsinh100 is probably the most useful one in general.  You would use the same Arcsinh100 preset curve in both layers to achieve a stretch of 100x.  It is quite possible to "mix and match" them - for instance using Arcsinh100 in one layer and Arcsinh300 in the other layer would give a stretch somewhere between 100x and 300x.

If you want to use these curve I'm making them freely available here: PS_ArcsinhCurves.zip

You need to unzip them into the relevant Photoshop folder.  On my Windows machine that is C:\Users\Mark\AppData\Roaming\Adobe\Adobe Photoshop CC 2015\Presets\Curves  but if you don't know where your own folder is, just try to save any arbitrary curve as a preset and notice which folder Photoshop is using.

Enjoy!

Mark

At occasions like these I'm glad I use PixInsight. :evil4:

Seriously though, great write up. And thanks again for the PI script.

  • Like 1
Link to comment
Share on other sites

1 hour ago, wimvb said:

At occasions like these I'm glad I use PixInsight. :evil4:

Seriously though, great write up. And thanks again for the PI script.

I quite enjoyed the challenge of finally getting Photoshop to do this.  As you can imagine, I went down numerous false trails until finally I found a method that worked.

Mark

Link to comment
Share on other sites

46 minutes ago, carastro said:

Just to be clear Mark, does this go in place of step 8, or both step 7 & 8 in your previous tutorial?

It replaces both steps 7 & 8.  So use an Arcsinh preset curve instead of the Gamma adjustment in step 7 and an Arcsinh preset curve instead of the curve adjustment in step 8.

The updated instructions in detail:

  1. Open the image in Photoshop
  2. In the Layers menu right click Background layer and do Duplicate Layer.  Name this new layer "Grey".
  3. Click on the "Grey" layer and go to Image->Adjustments->ChannelMixer.  Click on Monochrome and set the source channels to be 33% each then hit OK.  This converts the layer to grey. 
  4. Right click the "Grey" layer and do Duplicate Layer.  Name this new layer "Grey Divide" as a helpful hint to the role it will play.
  5. Click on the "Grey" layer; add a group; move the "Grey" layer into the group and  set the blend mode of the group to "Multiply"
  6. For the "Grey Divide" layer set the blend mode to "Divide". [Note:  if you don't have Divide as a blend option then set the blend mode to "Colour Dodge"  and do Image->Adjustments->Invert on the "Grey Divide" layer because an inverted Colour Dodge is the same as a Divide.]
  7. Click on the "Grey" layer and go to Layer->NewAdjustmentLayer->Curves to add a curves layer.  Select one of the Arcsinh preset curves.
  8. Click on the Curves layer and do Duplicate Layer.
  9. Optionally add a "Levels" layer between the 2 curves layers and adjust the black point if you think you need some extra background subtraction.

Your layers should now look like this:

PS_Arcsinh_Layers.jpg.4f0799bc9d432bbeefe563d3c091bb7f.jpg

If you wish, it is easy to go back and change which Arcsinh preset curve you are using in one or both of the Curve layers.

Mark

Edited by sharkmelley
Link to comment
Share on other sites

Hi Mark, hit a problem.

Have loaded the curve presets in as you can see from the screen shot, but when I try to perform the action in Curves itself, the only presets that show are the ones originally in Photoshop (see lower screen shot).

I tried rebooting to see if that was needed, but it has made no difference.

26f8a75d73096299897f5e61a5f1993e.620x0_q

Link to comment
Share on other sites

2 hours ago, sharkmelley said:

It replaces both steps 7 & 8.  So use an Arcsinh preset curve instead of the Gamma adjustment in step 7 and an Arcsinh preset curve instead of the curve adjustment in step 8.

The updated instructions in detail:

  1. Open the image in Photoshop
  2. In the Layers menu right click Background layer and do Duplicate Layer.  Name this new layer "Grey".
  3. Click on the "Grey" layer and go to Image->Adjustments->ChannelMixer.  Click on Monochrome and set the source channels to be 33% each then hit OK.  This converts the layer to grey. 
  4. Right click the "Grey" layer and do Duplicate Layer.  Name this new layer "Grey Divide" as a helpful hint to the role it will play.
  5. Click on the "Grey" layer; add a group; move the "Grey" layer into the group and  set the blend mode of the group to "Multiply"
  6. For the "Grey Divide" layer set the blend mode to "Divide". [Note:  if you don't have Divide as a blend option then set the blend mode to "Colour Dodge"  and do Image->Adjustments->Invert on the "Grey Divide" layer because an inverted Colour Dodge is the same as a Divide.]
  7. Click on the "Grey" layer and go to Layer->NewAdjustmentLayer->Curves to add a curves layer.  Select one of the Arcsinh preset curves.
  8. Click on the Curves layer and do Duplicate Layer.
  9. Optionally add a "Levels" layer between the 2 curves layers and adjust the black point if you think you need some extra background subtraction.

Your layers should now look like this:

PS_Arcsinh_Layers.jpg.4f0799bc9d432bbeefe563d3c091bb7f.jpg

If you wish, it is easy to go back and change which Arcsinh preset curve you are using in one or both of the Curve layers.

Mark

This is great, thanks Mark!

Quick question: do you think there would be any benefit to using this approach just to create a stretched image for use as Colour only? In other words have 2 completely separate images, and stretch the first one (however you normally go about doing it) for use as Luminosity, and then stretch the 2nd image using the above approach and use it just to colourise the Luminosity image. The reason I ask is, when I used the Gamma curve approach it appeared to me that a lot of the Green noise (i.e pixels) got removed, similarly to what HLVG does, but a side-effect to this was that the background then became more pockmarked. Processing colour separately to Luminosity should cure this. Thoughts?

Link to comment
Share on other sites

50 minutes ago, carastro said:

Hi Mark, hit a problem.

Have loaded the curve presets in as you can see from the screen shot, but when I try to perform the action in Curves itself, the only presets that show are the ones originally in Photoshop (see lower screen shot).

I tried rebooting to see if that was needed, but it has made no difference.

 

Hi Carole,

You put the curves in the Program Folder.  That's not where user defined curves should be stored because you need Admin Rights to save stuff there.

On my machine, I can see curves in the program folder:  C:\Program Files\Adobe\Adobe Photoshop CC 2015\Presets\Curves

I also have user defined curves in a user folder:  C:\Users\Mark\AppData\Roaming\Adobe\Adobe Photoshop CC 2015\Presets\Curves

If I put the Arcsinh curves in the program folder, it doesn't find them, just like for you.  If I put them in the user folder then it does find them.  Try saving any old curve from Photoshop and see which folder it puts it in.  That's how I found my user folder and that's where the Arcsinh curves need to be stored.

Mark

Edited by sharkmelley
Link to comment
Share on other sites

Well so far it did not work, Ended up with a pink mess, so I went back to the original tutorial and Actions I have made which worked before and that didn't work either.   

So maybe somewhere I am trying to use the wrong data or am missing something, as it has worked brilliantly every time up to now.

Carole 

Link to comment
Share on other sites

57 minutes ago, carastro said:

Well so far it did not work, Ended up with a pink mess, so I went back to the original tutorial and Actions I have made which worked before and that didn't work either.   

So maybe somewhere I am trying to use the wrong data or am missing something, as it has worked brilliantly every time up to now.

Carole 

I found that the black point setting (background removal) is very critical. You may need to play around with various settings.

Just a thought

Link to comment
Share on other sites

Thanks Mark,

I have been playing with the curves but the issue I have is the resultant pinkness of both nebula and small stars... I have tried three of the curves and tried differing placements of the black point but keep getting the following colour!

59eb787d42fd2_Autosaveafter2arcsinc300curvesandtworedboosts.thumb.jpg.5d536778415c5a2f927bad63310821ca.jpg

 

If you have any ideas to prevent this, I'm all ears! :help: I do like the way the curves and layers keep the stars under control :icon_biggrin:

Link to comment
Share on other sites

28 minutes ago, StargeezerTim said:

I have been playing with the curves but the issue I have is the resultant pinkness of both nebula and small stars... I have tried three of the curves and tried differing placements of the black point but keep getting the following colour!

The pink colour you are seeing is in your original data.  The colour preserving stretch faithfully preserves whatever colour is already there.  You can prove this yourself by placing a sample point in the image (right click the eyedropper and select "Colour Sampler Tool" - put a sample point in the image with the sample size set to point sample).  You will see that the proportions of R,G & B will be maintained before and after the stretch.

It's difficult to guess the underlying cause but I'm more than happy to take a look at your stacked file.

Mark

Link to comment
Share on other sites

4 hours ago, sharkmelley said:

The pink colour you are seeing is in your original data.  The colour preserving stretch faithfully preserves whatever colour is already there.  You can prove this yourself by placing a sample point in the image (right click the eyedropper and select "Colour Sampler Tool" - put a sample point in the image with the sample size set to point sample).  You will see that the proportions of R,G & B will be maintained before and after the stretch.

It's difficult to guess the underlying cause but I'm more than happy to take a look at your stacked file.

Mark

Here is the file Mark... I can't see that I'm doing anything wrong but you never know! I did try the colour sampler comparison and it looks like the stretched image is low on blue... Tim. 

Autosave.tif

Link to comment
Share on other sites

17 hours ago, StargeezerTim said:

Here is the file Mark... I can't see that I'm doing anything wrong but you never know! I did try the colour sampler comparison and it looks like the stretched image is low on blue... Tim. 

Autosave.tif

Thanks for the file - I took a look at it and the same pink is definitely there in the original.  You'll see it if you simply perform a "Levels" operation, bringing the black slider up to around 11 and the white point slider down to around 50.

Mark

Link to comment
Share on other sites

Hi Mark ....

I am just getting into LRGB processing and I trying all of the different methods as I come across them so that I can compare and fully understand what is going off because I am so new to all of this :-) I came across this topic earlier today and I must say it looks very interesting !

I downloaded your image of the north American nebula and followed your directions ... and it worked just great. I was really impressed.

Since then I have been trying to see what happens when I try some of my RGB files that I made a few nights ago of M33.

I calibrated and stacked my RGB subs (without any stretching as you said in your first post) and then, in PS, I copied these into the RGB channels on a new layer and followed the same directions as before.

The result was a very dark image .... barely different to the one that I started with ... mainly black with a few faint stars showing. I just could not bring out the galaxy at all ... even the slightest hint of it :-( I know it is there when I use different processing methods in PS.

Are the RGB files that I am using the "wrong" sort ... or am I doing something obviously wrong ????

Any hints would be most welcome.

Mike

Link to comment
Share on other sites

6 minutes ago, SlimPaling said:

Hi Mark ....

I am just getting into LRGB processing and I trying all of the different methods as I come across them so that I can compare and fully understand what is going off because I am so new to all of this :-) I came across this topic earlier today and I must say it looks very interesting !

I downloaded your image of the north American nebula and followed your directions ... and it worked just great. I was really impressed.

Since then I have been trying to see what happens when I try some of my RGB files that I made a few nights ago of M33.

I calibrated and stacked my RGB subs (without any stretching as you said in your first post) and then, in PS, I copied these into the RGB channels on a new layer and followed the same directions as before.

The result was a very dark image .... barely different to the one that I started with ... mainly black with a few faint stars showing. I just could not bring out the galaxy at all ... even the slightest hint of it :-( I know it is there when I use different processing methods in PS.

Are the RGB files that I am using the "wrong" sort ... or am I doing something obviously wrong ????

Any hints would be most welcome.

Mike

It's difficult to say if you are doing anything wrong.  I'm not familiar with the steps involved in creating an RGB image from separate channels but there's no reason for my stretch method not to work.  Before using the stretch you should have an RGB image from which you have subtracted as much background as possible by adjusting the black point with "Levels".  To make things easy for yourself, flatten the layers in your image so you are starting with a single layer.  This is then the image you duplicate and make grey in "step 2".

Mark

Link to comment
Share on other sites

Hi Mark

Successfully tried this in PaintShop Pro X7, pretty much the same as PhotoShop.

In your original numbered flow:

Step 3 becomes Adjust ->Color ->Channel Mixer

Step 6,  Image ->Negative Image

Step 7,  the 0.4/2.5 Gamma is achievable in Brightness & Contrast ->Histogram Adjust ->Gamma Slider to 2.5

Step 8,  Brightness & Contrast ->Curves

Am I right that you have altered your original step 3,  you now DO click Monochrome in Channel Mixer ?

Michael

 

 

Link to comment
Share on other sites

38 minutes ago, michael8554 said:

Hi Mark

Successfully tried this in PaintShop Pro X7, pretty much the same as PhotoShop.

In your original numbered flow:

Step 3 becomes Adjust ->Color ->Channel Mixer

Step 6,  Image ->Negative Image

Step 7,  the 0.4/2.5 Gamma is achievable in Brightness & Contrast ->Histogram Adjust ->Gamma Slider to 2.5

Step 8,  Brightness & Contrast ->Curves

Am I right that you have altered your original step 3,  you now DO click Monochrome in Channel Mixer ?

 

Well done for doing it in PaintShopPro!

Yes I DO now select the Monochrome option in Channel Mixer and make sure the percentages of Red, Green and Blue are sensible.  Beware that PS CS2 defaults to using 100% Red weighting when you select Monochrome, which is complete nonsense.

Mark

 

Link to comment
Share on other sites

6 hours ago, michael8554 said:

I've located where PaintShop Pro stores the Curves.

Could you possibly supply the XY coords (0 to 255) of the 100 and 300 arcsinh curves, so that I can set them up and store as presets?

 

Here is a text file with the X,Y points for the 5 curves: PhotoshopArcsinhCurves.txt

Here is a graph of them:

PhotoshopArcsinhCurves.jpg.7c33b7d1b8bcfa3f70cc4bb5d757fb47.jpg

 

Remember these curves are not the shape of the Arcsinh function but become the Arcsinh function when applied twice in succession.  Technically speaking they are the functional square root of the Arcsinh function.  But luckily you don't need to understand that to use them :wink:

Mark

 

Edited by sharkmelley
Link to comment
Share on other sites

Hi Mark

Retried today with your image, using the new workflow with the Multiply Group.

I found that in PaintShop Pro X7, the lower ArcSinh Curve 1 layer (with ArcSinh 100 applied, even twice) did not make any difference to the image.

I applied ArcSinh 100 twice to the ArcSinh Curve 2 and that did make substantial (good) changes.

Also the Levels layer would only make black level adjustments when moved above the ArcSinh Curve 2 layer, see image below.

This is probably a PaintShop peculiarity.

I've attached a Word Doc of the PaintShop Pro workflow if anyone wants to try.

The ArcSinh curves were plotted in the PaintShop Curves window, each one saved by clicking on the floppy-disc "Save Preset" icon.

 

 Colour_Stretch02.doc

 

Layers2.JPG.affba178113b201bb72df8e82154bbff.JPG                               

Edited by michael8554
Link to comment
Share on other sites

  • 3 weeks later...

Mark,

I just wanted to say a huge thank you for sharing this method.  I am still taking my first baby-steps in astroimaging, and it's only because of people like yourself and others on here who are always happy to share tips and give advice that I've been able to start creating some images that I'm very happy with.

The attached image of the central part of M33 was processed by following your guidance.

Graeme

M33.jpg

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.