5
$\begingroup$

Suppose you have generated an image using linear values for RGB channels. E.g. you linearly interpolated it when doing blending, etc.. When you're going to present this on the screen, should the values be transformed as $C_{\mathrm{linear}}\to C_{\mathrm{sRGB}}$ as given here or backwards as described here?

It would seem that the image should be encoded in sRGB, thus the forward transformation is necessary. But I've measured response of my monitor, and it appears that to have linearly changing brightness with input RGB, the color data have to be transformed as $C_{\mathrm{sRGB}}\to C_{\mathrm{linear}}$ as if my image were already in sRGB color space (the behavior is consistent with that described in another question).

So is it correct that to render and present an image one has to do the following:

  1. Draw in linear RGB to have correct blending
  2. Treating the data as if they were sRGB, convert to linear RGB
  3. Present on screen, so that monitor now converts this back

Then the result will be linear as expected. Or am I missing something?

$\endgroup$
  • 1
    $\begingroup$ Your monitor probably needs calibrating/adjusting if it looks like it's linear. To get a good range of colour brightness without obvious banding for the (non-linear) human visual system when you only have a very limited, 8 bits per channel, you need to use a non-linear image encoding as sRGB. Typically monitors should support this but it's not uncommon for them to be poorly calibrated especially if someone's been fiddling with the contrast/brightness controls. Your monitor might need adjusting. To summarise: render in linear with more than 8bpc (e.g 12 or half-float) and map to sRGB. $\endgroup$ – Simon F Sep 9 '16 at 11:21
  • $\begingroup$ @SimonF I don't think so. See the linked question, it says that what I observe is as expected — superlinear change of brightness with input data. Also my monitor shows this image as said in its description, suggesting that it's calibrated satisfactorily. $\endgroup$ – Ruslan Sep 9 '16 at 12:18
  • 1
    $\begingroup$ Sorry, caffeine deficiency! RE " When you're going to present this on the screen, should the values be transformed as Clinear→CsRGB as given here" It's that one, (not the reverse). What you should expect is that (and this is from memory so I may be off by a few values) approx "128/255" in linear should map to about "187/255" in sRGB. Since the eye can perceive smaller deltas in brightness when the colours are darker, you want more displayable shades in the darker end of 'the palette' than at the brighter end. Also, at the start of the linked Q, subst sRGB for RGB to make correct. $\endgroup$ – Simon F Sep 9 '16 at 13:25
  • $\begingroup$ @SimonF thanks, I seem to have realized where I had a mistake. Made an answer to my own question now. $\endgroup$ – Ruslan Sep 9 '16 at 14:34
1
$\begingroup$

The monitor interprets its input data as encoded in sRGB color space. This means that to actually display them, i.e. to get brightness of the subpixels it does the transformation $C_{\mathrm{sRGB}}\to C_{\mathrm{linear}}$. This transformation is basically application of gamma of $\approx2.2$ to the value, so that output brightness will be superlinearly dependent on input data. Since non-extremal input values are $<1$, they'll all be darker than with linear response.

Now if you have rendered an image in linear RGB color space, you need to compensate the transformation the monitor does. Thus you convert the image to sRGB, i.e. apply the $C_{\mathrm{linear}}\to C_{\mathrm{sRGB}}$ transformation. This transformation is inverse of what the monitor does: it applies a gamma of $\approx1/2.2$ to the values, so all non-extremal values will be larger than original.

In the OP I was coming to the wrong conclusion because of a mistake when trying to match the output of monitor with my input. To match it correctly one needs to either apply $C_{\mathrm{sRGB}}\to C_{\mathrm{linear}}$ transformation to input data to simulate what the monitor does with them, or apply backward transformation to the measured output — to undo monitor's processing.

$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.