Assigning an icc profile to a linear image

Hi there, I want to assign an icc profile that I created in CoCa to some astrophotography images I’ve taken. The camera records linear RGB data with no profile and the image stacking program outputs the file in linear format also. I would like to import this linear file into Gimp (if possible) as a linear image and apply the icc profile to remove colour bleed from the Bayer matrix.

However, when I open the file in Gimp 2.10.32, it tells me that the file is an “RGB Color 16-bit sRGB Gamma integer” file. I don’t know whether Gimp is applying an sRGB gamma profile to the original file or whether it’s just assuming this in the absence of any other information. Now I’ve tried changing this to a linear image using “Image/Precision/Linear Light”, however that tool appears to be processing/converting the image to linear, rather than simply treating the image as linear. Of course, it could be converting it back to linear after applying the sRGB gamma profile on import. I don’t know enough about to GIMP to know what it’s doing.

What I do know is that if I try to apply the icc profile to the “sRGB” and “Linear” versions of the image, I get a different result, so Gimp’s done something to the image.

How can I import this linear image into Gimp as a linear image? Or is the “Image/Precision/Linear Light” tool converting the image to linear after an auto-correct import on loading?

Alternatively, do I need to do this RawTherapee (which looks horrendously complicated :slight_smile: ).

Thanks, Andrew

It looks like RawTherapee is exporting the TIFF with a non-linear gamma sRGB profile. That file should be identified in the Output Profile value in the Color Management tab. All you have to do is change that to a linear profile; you can get such from Elle Stone’s github repo:

https://github.com/ellelstone/elles_icc_profiles/tree/master/profiles

If you want to stay in sRGB, ’ sRGB-elle-V2-g10.icc’ is a good choice; ‘g10’ indicates it’s a linear profile.

I suggest you assign the appropriate linear ICC colour profile (such as sRGB-elle-V4-g10.icc, assuming your image has sRGB primaries) before opening the file in Gimp. Then everything seems to work as we might hope.

Perhaps you can assign a profile with Gimp. I do it with ImageMagick:

magick in.tiff -profile sRGB-elle-V4-g10.icc out.tiff

If the input has the wrong profile, remove it before assigning the correct one:

magick in.tiff +profile "*" -profile sRGB-elle-V4-g10.icc out.tiff

Tell Gimp to “keep” the current profile. Gimp will convert the image to non-linear sRGB for displaying on the screen, and histogram, etc. When saving the edited image, ensure the “keep profile” box is ticked.

1 Like

Thanks for your replies.

I have created my own icc profile by imaging a Macbeth colour chart under D50 conditions with my Astrophotography camera. I would like to assign this profile to my images (in whatever program works, I thought Gimp might do this). I haven’t gone through Rawtherapee for any manipulation.

So if I understand correctly, I should be using ImageMagick to assign the icc profile to my image, rather than trying to do it in Gimp?

Andrew

It can be done in Gimp: menu Image, Color Management. There, you can assign a profile, or convert to a new profile, or discard a profile.

So if I have a linear image with no embedded profile, it looks very dark in Gimp. When I use that menu to assign Elle’s profile, the image looks good (like a normal sRGB file).

1 Like

Thanks again, I’ve been applying the colour profile in Gimp, but I’m not sure it’s doing what I want since I think it believes it has an sRGB profile applied to the image (as that’s what it says up the top), rather than treating it as linear. The title of the original base image as shown in Gimp is “FileName RGB Color 16-bit sRGB Gamma integer, GIMP built-in sRGB…”.

When we create and process our astro images, we do everything in linear space and make them quite bright. When I apply the icc profile to the linear image, it blows out the image and makes it very bright. I’m wondering if it would be better (more accurate) to apply a gamma of 0.45 to the image to force the program to the sRGB profile.

I have attached the workflow below to show you what I mean, hopefully this helps.

Thanks, Andrew

I think it believes it has an sRGB profile applied to the image (as that’s what it says up the top), rather than treating it as linear. The title of the original base image as shown in Gimp is “FileName RGB Color 16-bit sRGB Gamma integer, GIMP built-in sRGB…”.

Gimp doesn’t say it has an sRGB profile, does it? It just says the image is sRGB. This is because Gimp, like many programs, assumes that images are encoded as (non-linear) sRGB unless told otherwise, either by metadata or user input.

When I open a linear image with no embedded profile, I get a similar message:

[t] (imported)-4.0 (RGB color 32-bit gamma floating point, GIMP built-in sRGB, 1 layer) 267x233 - GIMP

Then, after I assign a linear profile, the message changes, and the displayed image brightens.

The sRGB Transfer Response Curve (TRC) is approximately gamma 2.2. So applying the opposite (gamma 1/2.2, which is gamma 0.454545), as well as applying the sRGB TRC should have almost zero overall effect. The two operations will nearly cancel each other.

An alternative is to take your image and apply a non-linear sRGB ICC profile, ie “pretend” that your linear image is really non-linear.

If you are looking for accuracy, then that depends on what processing you have done. You say “When we create and process our astro images, we do everything in linear space and make them quite bright.” How do you make them quite bright? Do you simply multiply all pixels by some number? Or do you apply a curve?

If you multiply all pixels by some number, then the image remains encoded in linear space, and applying a normal sRGB profile would be correct (assuming that is what you want, of course). But if you have applied a curve (for example to raise mid-tones without changing black or white) then the image is no longer linear, and accuracy is lost.

(I should say: I don’t do astro photogaphy.)

EDIT: When I say “the image remains encoded in linear space”, I mean that values remain proportional to energy received.

1 Like

Thanks, that makes sense.

So Gimp is assuming the image is sRGB encoded as there’s nothing to suggest to Gimp that it isn’t. So when I force Gimp to convert the image to linear space (using “Image/Precision/Linear Light”), it removes the sRGB profile it applied by default? So then if I then apply my measured icc profile for the camera, convert it back to sRGB then I should be colour corrected?

If so, then I get a slightly different result from that shown above.

2020-09-28-1047_4-L-Jup_norm-70-test_AS_F5000_l6_ap69_Driz30 Linear Coca sRGB 8bit

And yes, the brightening is a linear multiplication, no curves.

So Gimp is assuming the image is sRGB encoded as there’s nothing to suggest to Gimp that it isn’t.

Yes.

So when I force Gimp to convert the image to linear space (using “Image/Precision/Linear Light”), it removes the sRGB profile it applied by default?

I don’t think it applied any profile by default. You can check this with Image/Color Management. If “Discard Color Profile” is greyed-out, then it has no ICC profile. Gimp simply assumes the image is sRGB.

Beware of “Image/Precision/Linear Light”. The tooltip says “Convert the image to linear light”. But you don’t want to convert the image. You just want to declare that the image is already in linear light. So I suggest you don’t use this operation.

So then if I then apply my measured icc profile for the camera, convert it back to sRGB then I should be colour corrected?

Yes, provided that ICC profile is for linear RGB. First assign that ICC profile (Image/Color Management/Assign Color Profile), then convert to an sRGB profile.

Note that I never say we “apply” a profile. The word is ambiguous. We either assign a profile to an image, or convert an image from one profile to another.

If so, then I get a slightly different result from that shown above.

Yes. Above, we assumed your image has values relative to the sRGB primaries. This may not be true.

3 Likes