Jump to content

Stargazers Lounge Uses Cookies

Like most websites, SGL uses cookies in order to deliver a secure, personalised service, to provide social media functions and to analyse our traffic. Continued use of SGL indicates your acceptance of our cookie policy.

  • Announcements

    sgl_imaging_challenge_banner_lunar.thumb.jpg.ef4882eb5fb3610f8a68e5e6913de0e3.jpg

sharkmelley

Colour Preserving Stretch in Photoshop

Recommended Posts

sharkmelley    962

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 1

Share this post


Link to post
Share on other sites
wimvb    1,918
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

Share this post


Link to post
Share on other sites
sharkmelley    962
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

Share this post


Link to post
Share on other sites
carastro    2,025

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

Carole 

 

Share this post


Link to post
Share on other sites
sharkmelley    962
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

Share this post


Link to post
Share on other sites
carastro    2,025

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

Share this post


Link to post
Share on other sites
Xiga    156
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?

Share this post


Link to post
Share on other sites
sharkmelley    962
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

Share this post


Link to post
Share on other sites
carastro    2,025

Thanks "Got em" I just missed out a step, needed admin permission for that too.

Will take a look at the new instructions.  

Carole 

 

 

Share this post


Link to post
Share on other sites
carastro    2,025

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 

Share this post


Link to post
Share on other sites
wimvb    1,918
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

Share this post


Link to post
Share on other sites
StargeezerTim    2,626

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:

  • Like 1

Share this post


Link to post
Share on other sites
sharkmelley    962
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

Share this post


Link to post
Share on other sites
StargeezerTim    2,626
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

Share this post


Link to post
Share on other sites
sharkmelley    962
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

Share this post


Link to post
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.

×