xicclu
Author: Graeme Gill

## xicc/xicclu

### Summary

Lookup individual color values forward or inverted though an ICC profile table or CAL file. xicclu is the analogue of the icclib tool icclu, but expands the capability to reverse lookup the Lut tables, and displaying PCS values in CIECAM02 Jab space. xicclu can also be used to plot the device value composition down the neutral axis for device profiles, or CAL file contents.
Few of the options that apply to ICC profiles apply to CAL files, although device value options such as -e or -E will work. To lookup inverted CAL values, use -f b.

### Usage Summary

xicclu [-options] profile_or_cal
-v level Verbosity level 0 - 2 (default = 1)
-g Plot slice instead of looking colors up. (Default white to black)
-G s:L:a:b Override plot slice start with Lab or Jab co-ordinate
-G e:L:a:b Override plot slice end with Lab or Jab co-ordinate
-f function f = forward, b = backwards, g = gamut, p = preview
if = inverted forward, ib = inverted backwards
-i intent a = absolute, r = relative colorimetric,
p = perceptual, s = saturation
-o order n = normal (priority: lut > matrix > monochrome)
r = reverse (priority: monochrome > matrix > lut)
-p oride x = XYZ_PCS, X = XYZ * 100, l = Lab_PCS, L = LCh, y = Yxy,
j = CIECAM02 Appearance Jab, J = CIECAM02 Appearance JCh
-s scale Scale device range 0.0 - scale rather than 0.0 - 1.0
-e flag Video encode device input as:
-E flag Video decode device output as:
n normal 0..1 full range RGB levels (default)
t (16-235)/255 "TV" RGB levels
6 Rec601 YCbCr SD (16-235,240)/255 "TV" levels
7 Rec709 1125/60Hz YCbCr HD (16-235,240)/255 "TV" levels
5 Rec709 1250/50Hz YCbCr HD (16-235,240)/255 "TV" levels
2 Rec2020 YCbCr UHD (16-235,240)/255 "TV" levels
C Rec2020 Constant Luminance YCbCr UHD (16-235,240)/255 "TV" lev
-k [zhxrlv] Black generation: z = zero K,
h = 0.5 K, x = max K, r = ramp K (def.)
l = extra PCS input is portion of K locus
v = extra PCS input is K target value
-k p stle stpo enpo enle shape
stle: K level at White 0.0 - 1.0
stpo: start point of transition Wh 0.0 - Bk 1.0
enpo: End point of transition Wh 0.0 - Bk 1.0
enle: K level at Black 0.0 - 1.0
shape: 1.0 = straight, 0.0-1.0 concave, 1.0-2.0 convex
-k q stle0 stpo0 enpo0 enle0 shape0 stle2 stpo2 enpo2 enle2 shape2
Transfer extra PCS input to dual curve limits
-K parameters Same as -k, but target is K locus rather than K value itself
-l tlimit set total ink limit, 0 - 400% (estimate by default)
-L klimit set black ink limit, 0 - 100% (estimate by default)
-a show actual target values if clipped
-b use CAM Jab for clipping
-m merge output processing into clut
-c viewcond set viewing conditions for CIECAM02,
either an enumerated choice, or a parameter:value change
pp - Practical Reflection Print (ISO-3664 P2)
pe - Print evaluation environment (CIE 116-1995)
pc - Critical print evaluation environment (ISO-3664 P1)
mt - Monitor in typical work environment
mb - Monitor in bright work environment
md - Monitor in darkened work environment
jm - Projector in dim environment
jd - Projector in dark environment
pcd - Photo CD - original scene outdoors
ob - Original scene - Bright Outdoors
cx - Cut Sheet Transparencies on a viewing box
s:surround n = auto, a = average, m = dim, d = dark,
c = transparency (default average)
w:X:Y:Z Adapted white point as XYZ (default media white, Abs: D50)
w:x:y Adapted white point as x, y
a:adaptation Adaptation luminance in cd.m^2 (default 50.0)
b:background Background % of image luminance (default 20)
f:flare Flare light % of image luminance (default 1)
g:glare Glare light % of ambient (default 2)
g:X:Y:Z Glare color as XYZ (default media white, Abs: D50)
g:x:y FGare color as x, y
inoutfile The input ICC profile or CAL file.
The colors to be translated should be fed into standard in,
one input color per line, white space separated.
A line starting with a # will be ignored.
A line not starting with a number will terminate the program.

### Flags and Parameters

The -v parameter sets the level of verbosity. Default is level 1, which repeats each input value, the colorspaces of input and output, the type of conversion algorithm used, and if the result was clipped. Level 2 adds prints extra information about the profile before doing the conversions. Level 0 turns off all verbosity, just outputting the results of each conversion. Use the latter to capture batch output ready for further processing.
The -g flag causes a plot of the device values along a slice through the Lab or Jab colorspace, rather than allowing the interactive looking up of color values. By default this will be the neutral axis from the white point to the black point, but the start and end can be overridden using the -G parameters. This is useful in determining the existing black generation in a CMYK profile, or exploring the behavior of various black generation options using the -k parameters. The profile must be a device profile, and the PCS must be either Lab or Jab. The default plot is up the neutral axis is from the white to the black point (scale 0 to 100%), and shows the percentage of each device colorant. To examine a profiles B2A table black generation, use the flag -fb to select the B2A table, or to invert the A2B table, and be able to explore black generation behavior, use the -fif flag. The appropriate intent can be selected with the -i flag, as can other flags appropriate to the function selected. See example.
If a CAL file is used, then -g will simply plot the each channels calibration curve. It will also plot the invers curve for -f b.
The -G s:L:a:b parameter overrides the plot slice start point of white, with some other point specified in Lab or Jab Profile Connection Space. The parameter must be a single string that combines s: with the three numbers separated by the ':' character (no spaces).
The -G e:L:a:b parameter overrides the plot slice end point of black, with some other point specified in Lab or Jab Profile Connection Space. The parameter must be a single string that combines s: with the three numbers separated by the ':' character (no spaces).
The -f flag selects which type of table or conversion is to be used. In addition to the usual four tables that can be accessed in a fully populated Lut based profile, two additional options are available in xicclu. One is to invert the forward table, and the other is to invert the backward table. For non Lut based profiles, -fif is equivalent to -fb, and -fib is equivalent to -ff. Note that the -fib combination may not be fully supported.
The -i flag selects the intent table used for a lut based profile. It also selects between relative and absolute colorimetric for non-lut base profiles.
A profile is allowed to contain more than the minimum number of elements or table needed to describe a certain transform, and may contain redundant descriptions. By default, Lut based table information will be used first if present, followed by matrix/shaper information, and only using monochrome information if it is all that is present. The -o flag, reverses this order.
Normally the native PCS (Profile Connection Space) of a device or abstract profile is used, but the -p flag allows this to be overridden: -px: XYZ (scaled to 1.0), -pX: XYZ scaled to 100, -pl: L*a*b*, -pL: LCh, -py: Yxy space, -pj: CIECAM02 appearance space Jab, or -pJ: CIECAM02 appearance space JCh.
Note that the CIECAM02 output space selection by default uses the colorimetric table of the profile, but that the perceptual or saturation tables may be used by selecting them using the -i parameter. If the absolute colorimetric intent is chosen using -ia in combinations with -pj, then Jab with a fixed white reference is used, which emulates an absolute CIECAM02 Jab appearance space.
Usually device values are processed and displayed using a normalized value range between 0.0 and 1.0 Sometimes other systems scale them to some other range (such as 100 or 255) due to an underlying binary representation. The -s flag lets you input and display such data in its normal range. For instance, if your device values have a range between 0 and 255, use -s 255.
The -e flag applies a Video encoding to the input. See -E for the list of encodings.
The -E flag applies a Video encoding to the output. The possible encoding are:
n normal RGB 0..1 full range levels (default)
t RGB (16-235)/255 "TV" levels
6 Rec601 YCbCr SD (16-235,240)/255 "TV" levels
7 Rec709 1125/60Hz YCbCr HD (16-235,240)/255 "TV" levels
5 Rec709 1250/50Hz YCbCr HD (16-235,240)/255 "TV" levels
2 Rec2020 YCbCr UHD (16-235,240)/255 "TV" levels
C Rec2020 Constant Luminance YCbCr UHD (16-235,240)/255 "TV" levels
When inverting a CMYK profile, (ie. using the -fif flag), an input PCS value can have many possible CMYK solutions. To be able to return a unique solution, a black level (or black inking rule) should be chosen. The choice here reflect similar choices in black generation available in other tools (eg. colprof, collink), with the addition of two extra options.
Possible arguments to the -k option are:
-kz selects minimum black (0.0)
-kh selects a black value of 0.5
-kx selects the maximum possible black (1.0)
-kr selects a linear black ramp, starting at minimum black for highlight, and maximum black for shadow (equivalent to -kp 0 0 1 1 1). This is the default.
-kl uses an extra (fourth) value entered after the input PCS value, to select a black locus target between 0.0 and 1.0.
-kv uses an extra (fourth) value entered after the input PCS value, to select a black value target value between 0.0 and 1.0.
-k p stle stpo enpo enle shape allows an arbitrary black value ramp to be defined, consisting of a starting value (stle) for highlights, a breakpoint L value (stpo) where it starts to transition to the shadow level, an end breakpoint L (enpo) where it flattens out again, and the finishing black level (enle) for the shadows. There is also a curve parameter, that modifies the transition from stle to enle to either be concave (ie. the transition starts gradually and and finished more abruptly) using values 0.0-1.0, with 0.0 being most concave, or convex (the transition starts more abruptly but finishes gradually), using values 1.0-2.0, with 2.0 being the most convex.
Typical black value generation curve with parameters something like: -kp 0 .05 1 .9 .8
`1.0 K | enpo
| _______ enle
| /
| /
| /
| /
stle | ------/
+-------------------
0.0 K 0.0 stpo 1.0
White Black
`
-k q stle0 stpo0 enpo0 enle0 shape0 stle2 stpo2 enpo2 enle2 shape2 is a combination of the -kv and -kp functionality, with the black being preserved in CMYK to CMYK linking, with the output black constrained to be between the first and second set of curve parameters.
-K parameters. Any of the -k options above can use the -K version, in which rather than a black value target being defined by the inking rule, a black locus target is defined. For each lookup, the minimum possible black level and the maximum possible black level is determined, the former corresponding to a locus target of 0, and the latter corresponding to a locus target of 1. For instance, at the white point, no black will be used in the output, even if the black locus specifies a maximum (since the maximum amount of black that can be used to print white is actually zero). Similarly, at the black point, black may well be used, even if the black locus specifies zero black (since a certain amount of black is needed to achieve the desired density of color).
``
The -g flag can be used together with the -fif flag, to plot out the resulting black channel behaviour for various -k or -K parameter values.
-l tlimit Sets the total ink limit (TAC, Total Area Coverage) for the CMYK inverse forward lookup, as a total percentage from 0% to 400%. If none is provided, it will be estimated from the profile relcolor B2A table. The ink limit will be in final calibrated device values if the profile includes calibration information.
-L klimit Sets the black ink limit for the CMYK inverse forward lookup, as a total percentage from 0% to 100%. If none is provided, it will be estimated from the profile relcolor B2A table. The ink limit will be in final calibrated device values if the profile includes calibration information.
If the -a flag is used for inverse forward lookups, then if the target PCS value cannot be reproduced by the device (ie. it clips), then the achievable, clipped PCS value is displayed.
If the -b flag is used for inverse forward lookups, then out of gamut clipping will be performed in the CIECAM02 Jab appearance colorspace, rather than L*a*b* colorspace.
The -m flag turns on an internal processing option, in which the per device curve lookup table processing is merged into the main multi-dimensional interpolation lut lookup.
Whenever PCS values are to be specified or displayed in Jab/CIECAM02 colorspace, a set of viewing conditions will be used to determine the details of the conversion. The -c parameter allows the specification of the viewing conditions. Viewing conditions can be specified in two basic ways. One is to select from the list of "pre canned", enumerated viewing conditions, choosing one that is closest to the conditions that are appropriate for the media type and situation. Alternatively, the viewing conditions parameters can be specified in detail individually. If both methods are used, them the chosen enumerated condition will be used as a base, and its parameters will then be individually overridden.
The final parameter is the name of the ICC profile to be used. On the MSWindows platform a .icm extension is generally used, and on Apple or Unix/Linux platforms a .icc extension is often used.

### Usage and Discussion

Typical usage for an output profile might be:
xicclu -ff -ip profile.icm
Normally the program is interactive, allowing the user to type in input color values, each number separated by a space, and the resulting output color being looked up and displayed after pressing return. To batch process a group of color values, prepare a text file containing each input value on a separate line, and use the input indirection facilities of your command line shell to redirect this input file into the standard input of xicclu. The output can be captured to a file by redirecting standard output to a file. In most shells this would be done something like this:
xicclu -ff -ip profile.icm < inputvalues.txt > outputvalues.txt
When plotting the neutral axis behavior, plotting the existing B2A table behavior would typically be done something like this:
xicclu -g -fb profile.icm
Exploring possible black generation and ink limiting behavior might be done like this:
xicclu -g -fif -kp 0 .1 .9 1 .5 -l230 -L95 profile.icm