Color management

From Gentoo Wiki
Jump to:navigation Jump to:search
Note
This article has been postponed for at least 2 years, because the author does not feel competent enough on this complicated topic but alas no one else seems intending to write one, so better something than nothing. Hence readers are recommended to take everything with two pinches of salt and some pepper. And please help improve it if you actually know this stuff.

Color management at its simplest definition is a computer technique for ensuring colors stay the same or at least as close as possible between devices. Colors may differ due to different physical characteristics between devices and even imperfections between displays of the same model and ageing of a display.

Basic theory behind computer color

Despite the title of the section basic grasp of RGB is assumed until someone writes about the basics here.

Shortcomings of RGB

More fundamentally RGB is a relative scale that most commonly has a mere 256 states per channel which is largely insufficient to represent the vividness of the real world. For better or worse our eyes see the world in a logarithmic fashion with greater distinction between darker tones. This can be exploited to avoid encoding many bright tones that seem roughly the same to humans. Nevertheless color management and using the correct gamma function are not the same thing although both are required for correct end results.

Another issue is the aforementioned relativity where the color space is defined by the display characteristics, meaning that #FF0000, #00FF00, #0000FF and by extension #FFFFFF are in fact different tones from device to device.

sRGB

sRGB is Microsoft's attempt at fixing shortcomings of RGB, chiefly lack of absolute reference points and clarifies which gamma curve to use. On the down side, that curve itself is non-linear, adding complexity to proper sRGB support. Despite this sRGB is the de facto standard for RGB24/32 images and if it lacks a color profile then sRGB is the safest bet for files produced in the past 15 or so years.

Color management systems (CMS)

On Linux the two main solutions for display color management are Oyranos (media-libs/oyranos) and colord (x11-misc/colord).

KDE (Plasma 5)

Enable the colord USE flag and rebuild the world set. Emerge kde-misc/colord-kde to provide interfaces and session daemon to colord. media-gfx/displaycal-py3 can be used to calibrate the devices instead of GNOME Color Management as noted in KDE Plasma application System Settings -> Hardware -> Color Corrections.

GNOME

By default, GNOME uses gnome-base/gnome-settings-daemon to communicate with colord. Enable the colord USE flag and rebuild the world set. For at least non-lite version of GNOME that should be all that is required.

Others

Desktop environments like LXDE, Xfce, or i3 do not feature native means of communication with colord. However, it is possible to use xiccd (x11-misc/xiccd) which acts as an independent alternative to GNOME/KDE daemons. The display profiles can be associated with devices using colord's colormgr tool.

First, import the display profile file and obtain its newly assigned Profile ID:

user $colormgr import-profile display_profile.icc | grep "Profile ID"
Profile ID:    icc-d1c6fc06dd1a4fa72f5fe241aef755d7

Then get the Device ID of your device:

user $colormgr get-devices | grep "Device ID"
Device ID:     xrandr-LVDS-1

Now it is possible to associate the profile with the device, followed by making the new profile default by:

user $colormgr device-add-profile xrandr-LVDS-1 icc-d1c6fc06dd1a4fa72f5fe241aef755d7
user $colormgr device-make-profile-default xrandr-LVDS-1 icc-d1c6fc06dd1a4fa72f5fe241aef755d7

Verify the association has been made correctly:

user $colormgr device-get-default-profile xrandr-LVDS-1

Finally, make sure both colord and xiccd are set to start automatically and reboot the system.

Application support

GIMP

In theory GIMP has had color management for a bit longer than most applications, but if someone understands how to configure it to work properly with a CMS, go ahead, till then consider it broken.

Firefox

Go to about:config and set gfx.color_management.mode to 1 from the default value of 2. This will make Firefox treat untagged images as sRGB which generally is what you want.

Support for ICC v4 profiles[1] can be enabled by setting gfx.color_management.enablev4 to true. The support can be verified by a dedicated ICC's test page.

For best results also install a color management system or alternatively set the gfx.color_management.display_profile to the correct color profile file. Naturally, this will not work with two displays.

mpv

When using mpv's OpenGL presentation driver (not the legacy one inherited from MPlayer!) it's possible to configure it to always output sRGB which usually is already the case but could not be the case for nowadays more exotic or old content. Alternatively when built with LittleCMS (lcms USE flag) support the same OpenGL presentation driver can also do full color management including with profile set in window properties but currently it will not tag the surface appropriately so care should be taken that the display color manager does not apply the display color profile again.

For detailed description see the article on mpv.

Darktable

By default Darktable uses the _ICC_PROFILE X atom[2] to obtain the color profile. The colord USE flag enables additional support for colord. Darktable can be set to use one of those methods or both.

The package bundles a standalone binary utility darktable-cmstest[3] which provides a convenient overview of system CMS' configuration.

External resources

TODO

  • Color calibration section or even an outright article as it's probably complicated enough on its own on Linux.
  • More applications such as [[Inkscape, Blender and other graphics processing tools.

References