How to generate 16 bit linear, gamma=1, output files?

I use enfuse for focus stacks, stacking 16 bit TIFF input.

In enfuse manual it is stated “As in all image fusion operations it is preferable to use 16 bit linear (i.e. gamma = 1) images throughout,”., section 8.6.2.

How can I instruct RT to generate a 16 bit TIFF linear (i.e. gamma = 1) with ProPhoto color profile (similar to RTv4_Large, bundled output profile, but linear, gamma=1), from raw input files?

This is, IMO, a bit more of a pain in the *** than it should be (I admit, this is one of the few things darktable made much easier), but:

There’s an ICC profile generator tool - use that to build a linear ProPhoto ICC.

(In my opinion, for the “standard” stuff like this, it should be doable “on the fly” instead of going into the generator tool and creating/saving a file that you reference later.)

You have custom gamma options near the place where you select the output profile , right ?

Something like gamma 1 and slope of 0 (or 1) should work , i guess ? I’m not sure about the other values, bur I’ve used this in the past.

I don’t know RT, but a possibe answer is to use LargeRGB-elle-V4-g10.icc by Elle Stone. This is a “linear ProPhotoRGB” colorspace.

See Elle Stone's well-behaved ICC profiles and code and


May be able to use the abstract profile in color management…I think it let you apply custom gamma?? I think anyway…

Edit sounds like what you need to do… From RT documetation

  • Particular export requirements: you can decide to work with a linear gamma for example, for exporting to another software application (for printing, or for modification in Photoshop or Gimp) and/or to see the results directly on your monitor.

For occasions like this, I add in my builds a linear profile from Elle stone ACEScg-elle-V4-g10.icc in ICCprofiles/output as @snibgo suggested.
It is the simplest.

This kind of profile should be bundled with RT.

I’m not a regular RT user, but it should be as simple as selecting the Neutral profile, then exporting with a linear ProPhoto ICC. +1 on the suggestions to use Elle Stone’s LargeRGB-elle-V4-g10.icc. Now I’d be inclined to use her V2 version for exporting; not all softwares handle V4 profiles. Here’s a link directly to the profile:

On the colour tab, there is an export reference image button. It isn’t called that exactly. I think it is what you are looking for. I haven’t used it in a while, so maybe it is a mosaic… This would elucidate:

The abstract profile is unrelated to the profile used for export. Our export profiles are (for better or worse) always ‘gamma encoded’. If you want to ensure other software immediately assumes the file is linear RGB, the simplest option is the one @snibgo provided and install one of Elle Stone’s ICC profiles and select that as output profile.

There is still quite a bit of room for improvement in RT for this.

Then I think the documentation should be changed because is makes it sound like you will serve up linear data to an external program?? Maybe I misread it??

This was not written by me but is in the documentation

  • Particular export requirements: you can decide to work with a linear gamma for example, for exporting to another software application (for printing, or for modification in Photoshop or Gimp) and/or to see the results directly on your monitor.

@Entropy512, Thank you. Your proposal worked. I used the RT ICC profile Creator tool with ‘ProPhoto’ primaries and ‘linear_g1.0’ tone response curve and created a new icc output profile, which I used as raw->tiff output profile in RT. I did not touch ‘abstract profile’, so this was kept at ‘none’.

An attempt to verify: RT | Color tab | Color Management | ‘no profile’, shows no change in apperance. That is good. I interpret that as a sign that I have actually created linear tiff.

I also tried and verify using GIMP. GIMP loads the file and states “RGB Color 16 bit linear integer”.

How to verify linear gamma in a file?

@jorismak, @priort, yes, I can see the color tab | abstract profile and I can select ‘linear g=1’, but what shall I then use as color tab | ‘output profile’? Aha, this was @Thanatomanic feedback. Got it. Thanks.

@snibgo, @ggbutcher, @Thanatomanic, I can try Elle Stone’s profiles. Are they better than RT ProPhoto (RTv4_Large)? Thank you for the direct link to profile.

Ignore anything I said…I was just going from the documentation which seems to pretty clearly state that the abstract profile can be used to create linear data for GIMP or photoshop but I suspect there is something in that that I don’t understand…

You have multiple options: How to extract and examine ICC profiles - RawPedia

It is easy to check with e.g. ICC Profile Inspector that all icc profiles in the RawTherapee\iccprofiles\output folder have a non-linear gamma.

The confusion with the abstract profile is that you can make image appear as if it were encoded with other primaries or another TRC, but ultimately the export profile determines that. This point in particular is the main reason why I don’t like the introduction of the abstract profile.

1 Like

I’d say better only from the standpoint of being V2. I know Elle “scooched” the primaries of her profiles a bit to accommodate a rounding/truncation error she believed exists in the math, but I really don’t think you’ll notice a material difference in hue…

Thanks for clarifying …I fully understand it as you explain it but not as to how it comes across in the documentation…so it would be passed to the screen as linear but in the end encoded as dictated by the gamma of the output profile?? How would this get linear data to GIMP and photoshop as it appears to be given as a use case for that function??

You would have to have the other software assume a different profile for such files. It’s easy to do, but very counter-intuitive imo.

Actually, the display profile will inflict it’s own departure from linearity, with its TRC. All of this filmic/log/sigmoid/basecurve shenanigans is between linear and that…

@Thanatomanic ICC profle inspector show that my new profile is ProPhoto and gamma=1 (curves are linear). However ICC profle inspector is Windows only.

Is there a Linux alternative? iccdump from Argyl does not support icc-v4.

Exiftool on icc-profile or extracted icc does not show gamma directly. Instead exiftool -icc_profile:* gives me: ‘Red Tone Reproduction Curve : (Binary data 16 bytes, use -b option to extract)’, etc.

Edit: But how to interpret -b data?

Yer not gonna like this… :crazy_face:

I dumped a RedTRC tag from the LargeRGB-elle-V2-g10.icc file like this:

exiftool -b -RedTRC LargeRGB-elle-V2-g10.icc > foo.bin

Then, inspected foo.bin with hexdump like this:

$ hexdump -C foo.bin 
00000000  63 75 72 76 00 00 00 00  00 00 00 01 01 00        |curv..........|

Here’s the extract from the ICC spec regarding the format of the tag value:

6.5.2 curveType
The curveType contains a 4 byte count value and a one-dimensional table of 2 byte values. The byte stream is given below:

Byte Offset Offset Content Encoded as...
0-3 ‘curv' ‘(63726469h) type descriptor
4-7 reserved, must be set to 0
8-11 count value specifying number of entries that follow uInt32Number
12-end actual curve values starting with the zeroth entry and ending with the entry count-1. uInt16Number[]

Unless otherwise specified (see clauses 6.4.5: “blueTRCTag”, 6.4.16:
“grayTRCTag”, 6.4.18: “greenTRCTag”, and 6.4.37: “redTRCTag”) these 16 bit
unsigned integers in the range 0 to 65535 linearly map to curve values in the
interval [0.0, 1.0].

So, 8-11 are a 32-bit value, 1, indicates the curve is one 16-bit value in length, and 12-13 are a single u8fFixed8Number, a a fixed unsigned 2 byte/16 bit quantity which has 8 fractional bits (ha, wrap your head around that), with ‘01 00’ being the number 1.

THAT’s gamma = 1.0…

1 Like

I’m seeing even @Thanatomanic recommending Elle’s profiles over ones generated using RT’s icc profile generator

Is the icc profile generator built into RT (NOT the Abstract Profile which is not what I was suggesting) that broken?

I’ve used Elle’s code, but only because I found that modifying it it was the easiest way to generate ICC profiles with alternate/nonstandard transfer functions and gamuts. (Sony S-Log2/3, Panasonic V-Log, Sony S-Gamut, etc)