Some time ago I had spoken about the collection of tools and scripts SampleICC promoted by some people from the ICC to assist in the design of color profiles.
SampleICC can be easily downloaded and compiled. On Linux, the libsampleicc2 library is usually available in the repositories, which greatly simplifies the installation.
Returning a bit to the topic, I have noticed a series of utilities as quite interesting examples. Among them is create_display_profile intended to show us how to compile an ICC color profile based on the typical matrix-shaper or matrix-gamma structure, or in other words, a profile based on a 3×3 matrix transformation structure and a tonal adjustment curve or TRC.
After compiling this tool, it becomes an executable that receives the following parameters:
create_display_profile datos.txt 256 "mi_perfil_experimental" "by jpereira.net" matrix_trc.icc
Where “datos.txt” contains the necessary information to populate our profile. The data structure is organized sequentially by rows without spaces or tags; our txt file begins as follows:
- The coordinates of the primary colorants for RED in the XYZ space
- The coordinates of the primary colorants for Green in the XYZ space
- The coordinates of the primary colorants for Blue in the XYZ space
- The black point in XYZ
- The white point in XYZ
- The coordinates of the TRC curve in triplet form in the 0-1 range. If we want to implement a gamma curve, it is enough to specify the gamma. The number of steps of our TRC is indicated in the command line, in this example 256; if we use the gamma value, this value would simply be 1.
Thus, for example, we would have:
0.43585205 0.22238159 0.01391602 0.14302063 0.06059265 0.71383667 0.38533020 0.71704102 0.09713745 0.03343201 0.03486633 0.02983093 0.86415100 0.89869690 0.72640991 0 0 0 0.000274662 0.000274662 0.000274662 0.001388571 0.001388571 0.001388571 0.002487221 0.002487221 0.002487221 .... .... .... 0.989745937 0.989745937 0.989745937 1 1 1
If we were going to use a gamma curve it would be:
0.43585205 0.22238159 0.01391602 0.14302063 0.06059265 0.71383667 0.38533020 0.71704102 0.09713745 0.03343201 0.03486633 0.02983093 0.86415100 0.89869690 0.72640991 2.2 2.2 2.2
The example is designed to create Display type profiles, but to create one of the Input type, it is enough to change the class “icSigDisplayClass” to “icSigInputClass” around line 171 of the create_input_profile.cpp file and recompile.
With these simple steps, we can have an interpreter that helps us compile input profiles completely tailored to our needs or experiments; it is enough to know the coordinates of our primary colorants, the white and black points which are usually standard, and an appropriate TRC curve.
