New feature: automated gamut mapping

Seems like it is time for a detailed blog post about all that :wink:

  • preserve hue: when you apply a non-linear curve to the RGB channels, you always distort the colors. That is, if you start from RGB = 0.9, 0.2, 0.1 and you apply a film-like curve, the R channel will be compressed while the other two will stay the same because they are on the linear section of the curve.
    Let’s say you end up with RGBout = 0.7, 0.2, 0.1
    This is a different color with a different Hue.
    The preserve hue option rotates the three RGB coordinates so that the output luminance does not change, but the input hue is restored. The final color will have the same hue as the input one, but the same luminance and chroma as RGB=0.7,0.2,0.1

Here is an example from the same image as above. The tone mapping output is compared to the underexposed original image, to better see the hue differences.

“protect hue” disabled:

“protect hues” enabled:

  • clipping: in PhF all colorspace conversions are “unbounded” whenever possible. That is, if you start from a wide-gamut image with all RGB channels within the [0, 1] limits, you might end up with negative or >1 channels after the conversion to a smaller gamut colorspace, if some source colors don’t fit.
    The clipping options ensures that <0 and >1 values get clipped to 0 and 1 respectively, as if they were sent to a physical display device (you cannot have a negative light intensity, and you cannot exceed the maximum intensity).

  • black point compensation: this ensures that the black level of the source colorspace is mapped to the black level in the output. That is, RGB=(0,0,0) in the source image is always mapped to RGB=(0,0,0) in the output. This should be kept activated for all normal situations, and is usually disabled only in special cases, like soft-proofing.
    This option could probably be removed from the UI, but since it is part of the options in the ICC transforms I opted to make it available for whoever might need it…

To summarize, here is what I suggest to do if you have an high-contrast image and you want to prepare it for web display:

  1. convert the image to a suitable wide-gamut linear colorspace. Rec.2020 and ACEScg are two good choices.
  2. adjust the exposure so that mid-gray is at the right brightness level. This will probably push the highlights above the display limit, but we will recover this in the next step
  3. apply your preferred tone mapping method. Blender’s Filmic has no option for hue protection, and the output is directly in sRGB colorspace. My own tone mapping generates an output image in the same colorspace as the input, and provides the “hue preservation” option for better color matching
  4. add a colorspace conversion and select your target colorspace (for example, sRGB). Activate the channel clipping and use the “gamut warning” option to see how big are the out-of-gamut areas. If they are important, de-activate the gamut warning and activate the “gamut mapping” option. Adjust the saturation slider to the right if highlights become too washed out.
  5. export your image in sRGB colorspace

In future I will add the possibility to apply point 4. directly from the image export dialog, with real-time preview of the colorspace conversion result. For the moment, this has to be done as part of the image editing process…

Hope this helps!

3 Likes