Rec. 709 is a gamma correction formula. It’s used by some image file formats, notably the Netpbm formats (PPM, PGM, PBM, etc.). It’s older than sRGB, and similar to it, in that it is composed of a linear segment and an exponential segment pasted together.

The ITU-R Rec. BT.709 standard gives a formula for converting from Linear to Rec. 709:

Linear (L) to Rec. 709 (V) (official) | |
---|---|

Condition | Value |

0.000 ≤ L < 0.018 | V = L×4.50 |

0.018 ≤ L ≤ 1.000 | V = 1.099×L^{0.45} − 0.099 |

It does not, however, provide the inverse formula for converting from Rec. 709 to Linear, even though such a formula is pretty much necessary to do anything useful with Rec. 709. Apparently, you’re expected to derive it yourself.

Okay, I think can do that. Here’s what I get:

Rec. 709 (V) to Linear (L) (derived) | |
---|---|

Condition | Value |

0.00000000000000 ≤ V < 0.08100000000000 | L = R/4.50 |

0.08100000000000 ≤ V < 0.08124794403514 | undefined (or maybe constant 0.018) |

0.08124794403514 ≤ V ≤ 1.00000000000000 | L = ((R+0.099)/1.099)^{1/0.45} |

The *undefined* section bothers me. It won’t cause much of a problem in
practice, because you can just arbitrarily select one of two defined formulas,
and you’ll get roughly the same answer either way. But why not define an
*exact* value?

The formula implies that the individual functions should intersect at about 0.018, but they don’t. They intersect at two points that aren’t particularly close to 0.18:

(0.01619486680714426, 0.07287690063214917) |

(0.01999892065819229, 0.08999514296186531) |

It can’t be a concidence that the functions intersect at almost exactly 0.020, but then, why was 0.018 chosen as the cutoff point instead of 0.020?

Maybe 0.018 was chosen because it’s near the average of the two intersection points. But that doesn’t seem like a good reason to me.

I think the 0.020 intersection point is the one that should be selected as the cutoff point. It makes the function smoother than other choices would.

If you do that, you get the following “improved” Rec. 709 formulas:

Linear to Rec. 709 (improved #1) | |
---|---|

Condition | Value |

0.00000000000000000 ≤ L < 0.01999892065819229 | V = L×4.50 |

0.01999892065819229 ≤ L ≤ 1.00000000000000000 | V = 1.099×L^{0.45} − 0.099 |

Rec. 709 to Linear (improved #1) | |
---|---|

Condition | Value |

0.00000000000000000 ≤ V < 0.08999514296186531 | L = V/4.50 |

0.08999514296186531 ≤ V ≤ 1.00000000000000000 | L = ((V+0.099)/1.099)^{1/0.45} |

The following simplified formulas are, for all practical purposes, equivalent to the above:

Linear to Rec. 709 (improved #2) | |
---|---|

Condition | Value |

0.00 ≤ L < 0.02 | V = L×4.50 |

0.02 ≤ L ≤ 1.00 | V = 1.099×L^{0.45} − 0.099 |

Rec. 709 to Linear (improved #2) | |
---|---|

Condition | Value |

0.00 ≤ V < 0.09 | L = V/4.50 |

0.09 ≤ V ≤ 1.00 | L = ((V+0.099)/1.099)^{1/0.45} |