Linear gamma preview in RawTherapee

(Samuel Chia) #1

Hi everyone,

I have been trying to discover how to get RawTherapee to show be a preview of what my raw file would look like if the data is not gamma encoded, i.e. I would like to see a linear preview. I am trying to evaluate the true vignetting performance of my lenses.

I understand I can output a TIFF with linear gamma, or there is also the “save reference image” will gives a linear TIFF file. Both methods give me what I want, but then I need the additional steps to save the file and use another image viewer to look at it. I would like to be able to just look at the raw file itself inside RawTherapee. But I can’t find the function to cause the preview image to display as linear. I’ve tried unchecking the tone curve checkbox for the camera profile, changing the output gamma setting to “linear_g1.0”. Nothing I change in the output profile settings changes the preview (understandably). The preview still is not linear.

Hope someone can help! Thank you!

(Mica) #2

You can change your working color space to a linear profile, I believe.

If you’re talking about the thumbnails in the file browser, I don’t think that is possible.

(Samuel Chia) #3

Thanks for the suggestions, but there are only these profiles available in the dropdown for the working colour space. Also, I don’t believe that gamma applies to any of these choices. There is no such thing as a non-linear working space profile for RT. The internal working space of RT is always linear, and these spaces just define the colour primaries, if I am not mistaken. So it’s quite odd that the Editor preview, with the neutral processing profile applied with no further edits, is not linear.


The camera profile applied might be contributing to a tone curve being applied for tone mapping, but I can’t see how to turn that off. When I select “no profile”, it’s still not a linear result.

Also, thumbnail previews are always the same as the Editor previews, so if I can linearize the image by choosing the appropriate settings, the thumbnails should show linear previews also. Even so it doesn’t matter, because I want the RGB readouts in Editor mode to be able to derive the on-axis and off-axis falloff for vignetting calculations.

(Samuel Chia) #5

@afre, unfortunately when I change the output gamma, the preview never ever changes.

If I change the working space, the preview changes - it should and it does.

The “none” in your screenshot is the monitor profile choice. In your case it is “none” as you have asked RT to display its interface with no colour management (not good!) whereas in my case, it is my own monitor profile.

I found this RawTherapee colour management document, which may explain things:

rgb ==> RGB conversion - Working space “Working Profile”
This “conversion” converts rgb data (without color space) into the working space chosen by the user.

These working spaces are 8 of them (which sounds more than enough, or even too much…): sRGB, AdobeRGB, Prophoto, Widegamut, BruceRGB, BetaRGB, BestRGB, Rec2020. amongst these 8 profiles, 5 have a wide gamut: BetaRGB (origin B.Lindbllom), BestRGB, Rec2020, WideGamut and Prophoto.

During this conversion, an internal gamma is set by RawTherapee that always is “gamma sRGB” i.e. “gamma=2.4 and slope=12.92” (like Lightroom, see later on)

This, of course, is wrong. The encoding might be using inverse gamma 2.4 or gamma 1/2.4 if anything, not gamma 2.4 which would result in a super dark preview, way darker than linear gamma. As the preview is lighter than linear gamma, there is some conversion going on under the hood using gamma < 1.0.


Sorry that my earlier post didn’t help; I may remove it. I am still not entirely awake yet. :blush: I don’t know about the Rawpedia quote. Sometimes, it might just be a translation issue that makes it unclear.

My current thought is this. If changing the output profile gamma doesn’t change the preview,

1. Is there another setting that does that?
2. Could you export the file and re-open it in RT to see the linearity? If this works, it is an additional step but at least you are still in RT using RT tools…

(Morgan Hardwood) #7

Short of editing the code, you could use the tone curve to make an inverse gamma curve. You could plot the curve values using LibreOffice.
rawtherapee gamma.ods (14.0 KB)
gamma-22.rtc (215 Bytes)
gamma-045.rtc (212 Bytes)

(Glenn Butcher) #8

For display, you’re probably at the mercy of the display’s profile, which I’d bet is the reason you can’t see linear with a working profile change. For export, you might download @Elle’s profiles, she has gamma 1.0 versions of all the popular profiles.

(Elle Stone) #9

From curiosity, what do you expect the preview to look like “if the data is not gamma encoded”? Do you mean you want the image to be very dark, as if a proper linear gamma input profile hadn’t been assigned to the interpolated raw file, and instead something like regular sRGB (with its nearly perceptually uniform TRC) was assigned as the input profile?

In other words, I think I don’t understand the question. Is there an article that talks about what you are trying to do?

(Samuel Chia) #10

@afre, @Elle, @ggbutcher My apologies for the lack of clarity. I should care less what the preview looks like, since the preview is colour managed. What I mean to ask about is the RGB readouts below the histogram panel. The readouts are all gamma-encoded to the working space gamma, but I want to be able to also choose linear gamma readouts.

I see on this Rawpedia page that “The values the main histogram and Navigator panel show are either those of the working profile, or of the gamma-corrected output profile. You can choose which you prefer in “Preferences > General > Use working profile for main histogram and Navigator”.”

This seems to be outdated information as in the V5.4 build, this preferences option does not exist any longer. I see I have the V5.1 build, and looking at the preference, indeed that option is available! See this screenshot:

So when I uncheck the “Use working profile for main histogram and navigator”, indeed it does change the RGB readouts when I change the output profile to one with linear gamma, like the “RT_sRGB_g10” profile! Changing the output gamma does nothing, only the output profile. Now I am able to get linear RGB readouts.

How can I get this functionality back to the latest version of RT?

(Ingo Weyrich) #11

(Samuel Chia) #12

@heckflosse Ingo, you’re the best :slight_smile: Thanks very much!!!

(Morgan Hardwood) #13

As of today (using a development build from the dev branch, 5.4-625-g8613d169b or newer), you can preview a linear gamma working space. The end result looks the same as using my gamma 1/2.2 (0.45) curve.


The g10 profiles are no longer available in 5.4-641-gc45c638ed. Is that intentional?

(Morgan Hardwood) #15

One can now generate any profile one wishes:


Thanks. I noticed the new icon but didn’t click on it yet.

(Samuel Chia) #17

That’s really, really cool, thanks Morgan!


Guess what? You are looking at it if you use any number of properly crafted view transforms.

That is, the light projected out of your display is already linear. The transform happens at the hardware level, and is typically (99.9995%, including baseline reference DreamColors in sRGB emulation mode) an inverted 2.2 power function.

Despite what some folks believe, if you are working in a proper scene referred pipeline, you cannot merely slap a 2.2 power function on your data and go; it doesn’t work and is a painful confusion between display linear and scene linear representations. You need a proper view transform, that should at a bare minimum include a transfer function mapping, as well as a desaturation transform.

TL;DR: When you are looking at anything that looks “normal”, you are looking at a linear signal. Any buffoonery that tries to tell you that a “1.0 gamma” transfer function is linear is clueless; it would be a double upped transform, showing you as far away from linear as possible.

(Samuel Chia) #19

@troy_s You obviously didn’t see my earlier response. The preview is not the problem, I made an error in expressing my initial request. I need gamma 1.0 RGB readouts to be able to accurately compute the falloff of my lenses. The problem is that quite a few of the popular review sites (Lenstip, The-Digital-Picture, Optical Limits [previously Photozone], DXO Labs) are all wrong in how they calculate their vignetting values. A number of them are using the Imatest defaults for calculating falloff which is totally wrong unless the overall tone curve applied to the raw data is exactly gamma 2.0, which is most likely isn’t.

If you have proper display pipeline colour management, you can “slap” any power function on your data and it will still look the same on the monitor.


It is Impossible to calculate any curve with a base power function. It doesn’t work as it assumes a unity point of 1.0, which is legacy rubbish.

Uh no.