# Simple function to simulate different shutter speed / exposure by changing RGB values of image

What mathematical function can I apply to each pixel of an image to simulate an increase in shutter duration of a camera?

E.g. Let's say I have an image shot at 1/60s shutter speed. What function can I apply to the RGB values of each pixel of the resulting image to simulate a 1/30s shutter speed?

• I'm not qaulified to answer this, but I think the devs at darktable make this easier by doing exposure in "scene referred" linear colour (linear rec2020) before any peceptual / gamma changes are applied to the image. I think they deal with colour shifts separately. Commented Jan 6, 2023 at 16:19

## 2 Answers

The Kodak Gray Scale is the benchmark for your needs. Density is express as a logarithmic value. 0.30 density is a doubling of exposure = 1 f-stop a 2X change in opacity of film 0.60 = 2 f-stops 0.90 = 3 f-stops 1.20 = 4 f-stops 1.50 = 5 f-stops 1.80 = 6 f-stops The f-stop can be further divided 0.10 density = 1/3 f-stop 0.15 density = ½ f-stop 0.20 density = 2/3 f-stop

Gamma is a mathematical value that tells us the steepness of the change from white to black. We measure the angle of the graph going up. After measuring the angle, we use find its trig function TAN. This is the value we call Gamma.

Most consider a gamma of 2.2 will deliver the optimum realism for a computer monitor. A monitor with a gamma of 1.8 gives slightly brighter increments of change. Likely gamma 2.2 is best for your use.

• Can you please give an example of using this scale to achieve the objective? Thanks Commented Apr 2, 2022 at 11:14
• By tradition the shutter speed change increment is a doubling of halving of the exposure. The f-stop sequences also -- full stop = 2x change. We measure exposure change results using density. A 2X change in density = 0.30 = 1 f-stop. 2 f-stop = 0.60 3 f-stop = 0.90. Step 3 has a density of 0.35, just a tad more than 1 f-stop. The RGB value of a gray object will be 177R 177G 177B for monitor operating at 2.2 Gamma. Step 9 density 0.95 is just a tad over 3 f-stop thus a gray object reproduces 94R 94 G 94B. Gamma is a measure of the steepness of the graph. Gamma 2.2 is typical of monitors. Commented Apr 2, 2022 at 15:01
• To find the R G B value displayed by an 8 bit monitor system: Increment of change 1 f-stop = doubling or halfling shutter 1 increment or stopping down or opening 1 f-stop then the density change is 0.30 log base 10 = 2X change -- the invers is 1/2 = 0.50 reflectance X 100 = 100%. To convert to RGB thus 0.30 X 255 ^(1/2.2) = 186 stated as R186 G186 B186. In other words find the reflectance and multiply by 255 and then apply a Gamma correction by elevating this value by 1/2.2. Commented Apr 2, 2022 at 23:34

You can't really do that; at least not easily. As a general rule exposure in the (s)RGB color space is power 2.2; but first you have to normalize the number to a 0-1 base (i.e. 128 is .5 (% of 255max)), then apply the power 2.2 function, and then convert it back to an RGB value.

That only applies to RGB color spaces with a 2.2 gamma curve (most are). And worse than that is that the "2.2 gamma curve" isn't really 2.2... at very low values it is linear, followed by a section at 2.4 power, and it flattens out at the high end as well - it's really only pretty constant (2.2) in the middle values.

And you would have to apply the correction to each R/G/B value separately. But if you really wanted you can convert an RGB value to it's 0-1 value, plot that on the 2.2 gamma curve, determine what power actually applies at that point on the curve (red), and do the conversion using that value... (the black 2.2 line shows what a constant power 2.2 curve would look like).

• I'm aware of the details of sRGB <-> RGB conversion. But how to achieve the objective mentioned in the question? Commented Apr 2, 2022 at 11:22