Color management is about ensuring that colors in pictures or videos are reproduced as accurately as possible on every medium, such as screens, print media, or other output devices. This is especially important if you're using wide-gamut profiles and screens, which are becoming more and more commonplace nowadays.
People keep telling me that no one cares about color management but I find that very rude. Posting a nice picture of a cat should not suddenly turn it into a moody contrasty mess with bad lighting just because your social media website does not handle color profiles correctly. If your software touches pictures in any way, it should probably be aware of color management.
This does not mean that it should have to deal with it specifically, but that it should be aware of color profiles—even if this just means that any unknown input will simply be converted to Standard RGB before further processing happens.
Everyone pretends standard RGB is a “universal” color profile in some way, and so much software always assumes everything is in sRGB! This isn’t always appropriate!!
Consider, for example, this picture of a cat. The original image shown on the right uses the Adobe RGB profile, and the left image is what happens when software mistakenly reinterprets the image as sRGB. You might notice that the reds and greens become especially desaturated (though, depending on your viewing conditions, the difference may or may not be very discernable).
A much more appropriate solution would be to directly display as much of the full Adobe RGB gamut as possible, or to transform the image to the sRGB gamut if it’s really necessary.
However, the general state of affairs regarding this topic is rather lacking.
- Android didn’t have any color management until Android 8!
- Android device manufacturers sometimes seem to be marketing their wide gamut displays as being more “saturated” and having “richer colors” compared to other displays by directly mapping sRGB to the wider display gamut and thus causing all colors to be more saturated than intended, which is a very strange thing to do.
- Wayland color management was proposed only very recently!
- Many, many things will blend color in sRGB gamma—so much so that at this point, doing it in linear gamma may be considered an error sometimes. In fact,
Let’s talk about gamma. Simply put, it’s just a function that maps number values to brightness in each of the red, green, and blue channels.
It exists because apparently human vision is very strange and perceives colors nonlinearly (specifically, perceiving more details in dark colors), so it would be appropriate to have the computer do the same to get as much out of it as possible (why have details you’ll never see?).
Hence, the sRGB gamma curve looks like this:
It’s basically just a polynomial: ɣ(x) = x2.2.
There is, of course, no inherent problem caused by doing this. The problems start appearing if you now try to edit an image. Specifically, for normal blending, colors should always be blended in linear gamma.
This issue becomes most evident in gradients.
This is a gradient from pure red to pure green. Perhaps you’re already used to the look, but quite frankly... what is this muddy brown color doing there in the middle?
The muddy brown is caused by the gamma curve, and is made noticeable the fact that we’re going all the way across the color wheel. Because it transitions from (R: 1, G: 0, B: 0) to (R: 0, G: 1, B: 0), there will inevitably be a mid-point that looks like (R: 0.5, G: 0.5, B: 0). However, because the sRGB gamma curve maps 0.5 to a darker color, the color in the middle is also darker than either of the boundary colors.
If you blend the same colors in linear gamma, you get the actual expected result:
Just a straight line across the color wheel, without any weird brightness changes!
You can find this kind of incorrect blending in many places:
- iOS blur effects. For example, if you set your wallpaper to two flat colors and pull down Control Center to blur the screen, you’ll see a strange darker color at the boundary.
- Photoshop, by default, does not blend colors in linear gamma. However, it can be configured to “blend RGB colors using gamma 1.0” in Color Settings.
- Most compositors (i.e. software that needs to render images on top of other images). While this isn’t really a critical thing, it will look bad if you put a blurred image on top of a different color. Here’s a demo that uses your web browser’s compositor:
Curses and Hexes For Your Computer
Generally, I think there should be much more awareness of colors being a complicated mess, because otherwise people will be confused when their picture takes on strange hues, changes brightness, or features other strange effects that weren’t present before they used software without color management.
In fact, using more avant-garde color profiles, you can get much more extreme results from color misinterpretation.
Here's a handy test image that uses an extremely cursed color profile so that it produces two completely different images depending on whether color management is supported or not.
Thank you for coming to my ted talk please handle color profiles ok
- This article in CG Cinematography by Chris Brejon is a pretty good introduction to more technical details.
- If you’re only interested in getting
convert -stripto preserve color profiles, well, sadly, you can’t. However, you could try extracting the profile, running
convert -strip, and then putting it back.
- To integrate color management into a piece of software, there are color management libraries such as Little CMS that do all the fancy math stuff for you. I also attempted writing a rust version but it’s not really production-ready.
- Color management is like typography. Once you learn about it, you start seeing it be done wrong everywhere and it’s horrible.