need help to make smooth sun color gradient from RAW


I need help for processing a RAW image to get a similar result with a smooth sun color transition as my camera (Sony Alpha 7 IV) does for JPG.

I shoot RAW+JPG simultaneously. The camera’s original JPG looks like this:

When I open the appropriate RAW file with default darktable filters and no additional filters activated, I get this result:

I found the module filmic_RGB is responsible for this look and after disabling I get:

It still does not look good. The color gradient of the sun has hard edges and is not that smooth that the original Sony JPG looks like.
Unfortunately, I haven’t found the right module to change this to get similar results as the original Sony JPG looks like. What should I try?

Kind regards,

Do you have the original RAW file?

There is a play raw section in this forum, where you can upload your RAW files and other users can show their edits and give some hints.

See for example: Pale photo, need help

If you upload your RAW file, do not forget to add the creative commons license.

Hi Alexander!
This sort of photo can be a little tricky. I would probably be leaving filmic on, and try the different options in filmic for ‘preserve chrominance’ (luminance Y can be good) and just possibly the ‘color science’ option above it. These are under the options tab:
Also, try adjusting the ‘white relative exposure’ slider, in the ‘scene’ tab.

I expect you know it already, but, just in case, darktable has quite a useful manual with a getting started page here: darktable 4.0 user manual - process
It can take some reading but I found it useful :grinning: Good luck!

Hi, try experimenting with the different norms on the (edit: advanced) options tab of filmic. A value of no or luminance Y may work better for shots with bright light sources present in the frame.

Don’t be afraid to lower the white relative exposure, either: you don’t need to keep any details on the Sun disc.

That’s something for the new highlights recovery

I’m looking forward to it – but in general, I don’t expect details in the Sun.

Thanks all!

@7osema Good to know! I’ll upload the RAW file to play with including my attempts for comparison.

@123sg Thanks, luminance Y in filmic_rgb looks better but still not optimal. I could not get even better results with the other options in the filmic_rgb module.
Also, yes I have to read more documentation for the modules :slight_smile:

@kofa I do not have an advanced tab in filmic_rgb (darktable 4.0). luminace Y is much better, but also with changing white relative exposure I do not receive a result similar as the original Sony JPG.

@hannoschwalm Is there a new module highlights recovery in development or have I not found it?

My bad, sorry: should have been options (corrected in the original, too). Thanks for letting me know about the mistake.

Can you share the raw? Also, see my (our) struggles at:

Has been under devel for almost a year and been pushed as a pr this morning :slight_smile:


There aren’t any, all channels blown.

I had a similar situation shooting directly into the sun. It’s not a great image but I did it as an exercise. Using filmic rgb and color balance rgb I was able to get it to a point of not being too nasty, but the highlights are blown regardless. I think the best you can hope for is to minimize the damage, as it were.

Here’s how it looked in darktable:

IMG_4360 before and after

1 Like

Here is the RAW file: (25.8 MB)

This file is licensed Creative Commons, By-Attribution, Share-Alike.

_DSC3128.ARW.xmp (7.6 KB)

My quick edit:

  1. Turn off the highlight reconstruction module (sometimes it’s useful when used with filmic rgb’s reconstruction, especially in lch or color modes, but other times it just gets in the way, especially if it’s set to “clipping”, which is almost always horrible)
  2. Bump up exposure
  3. Relies on Filmic to handle the highlights.
    • in options, set “preserve chrominance” to luminance Y
    • before messing with reconstruct, I changed filmic’s white and black relative exposures (as they affect the highlights clipping threshold)
    • set the highlights clipping threshold to cover the sun’s clipping, changing highlights color to -100% (gray)
    • back to options to set iterations of high-quality reconstruction to 3 (so it does a few passes with reconstruction to intensify the reconstruction)
  4. I did adjust the tone equalizer by going to masking, clicking on the magic wand (twice, first to activate the module, then a second time when it was ready to actually figure out the mask compensation) for “mask exposure compensation”, then I used the scroll wheel over the picture to brighten and darken a few places… as I considered it a little too much, I added a simple mask to make the opacity around half (to tone down the effect).
  5. For a final touch, I went to the color balance rgb module and set it to vibrant colors in its ≡ menu.

_DSC3128.ARW.xmp (6.7 KB)

Here’s a very basic adjustment, with highlight reconstruction set to color and filmic set to luminance Y. It’s dark, as it is meant as a minimalistic quick starter using a less complex method that can also work in some cases. It needs more work done, of course:

_DSC3128_01.ARW.xmp (6.3 KB)


I opened your raw in rawproc, my hack processor, so we could see the unmodified rgb (except for display profile). Here 'tis, zoomed in on the sun:

Magenta is where the highlights are blown in all three channels and the whitebalance yanks the three pile-ups in different directions. This has to be mitigated somehow, usually with a purpose-built highlight reconstruction operator. But notice the orange border around the magenta; that’s really your “gradient”. I found out something working your image; I had been adding the highlight reconstruction tool after scaling the data from the raw range to the 0.0-1.0 display boundaries, but that was glomming both the magenta and orange into one blob. I tried moving the HR tool to before that scaling, and things looked much better. Learn something new every day…

filmic curves by default tend to push high pixels like these to the top, but I think darktable’s implementation lets you pull that back. I used my simple filmic curve with that in mind, and got this rendition:


This is quite nice!
I’ve shot few direct to the sun and struggled with it too. Tried with laplasian reconstruction but for some reason it often pushes towards reddish tones instead of yellowish. Will try your method too.

Guys, I don’t want to hijack the thread but I noticed @OrcLex is using Sony Alpha 7 IV
I was checking the DP review site for samples and for some reason some images (same camera) can’t open.
For example - this one

While the one from @OrcLex works well.

Do you know if it is some specific with how the image is saved? Or have you seen it before?
I don’t have the camera but it is on the “dream list”.

I look forward to trying out your new highlight recovery method. I have struggled with the lapalacian highlight recovery despite watching the videos about it. I accept that in many situations there is little you can do and it will be ‘damage limitation’ but some methods limit the damage in more pleasing ways than others.

My guess is uncompressed vs compressed .

1 Like