## profile/printcal

### Summary

Create a printer linearization calibration file from .ti3 test chart patch values.
This is often very useful in preparing a raw printer for profiling, by establishing per-channel ink limits, and linearizing the channel response.
It is typically not so useful when used with "RGB" printers, since these already have a well controlled response, and the RGB channels are not native colorant channels.

### Usage Summary

`printcal [-options] [prevcal] inoutfile``
` `` `-v verbosity` `Set verbosity level``
` `` `-p [2]``Plot graphs.``
` `` `-w` `Save colorant 3D plot to inoutname_r.x3d.html and inoutname_c.x3d.html``
` `` `-i` `Initial calibration, set targets, create .cal``
` `` `-r` `Re-calibrate against previous .cal and create new .cal``
` `` `-e` `Verify against previous .cal``
` `` `-I` `Create imitation target from .ti3 and null calibration`
`` `-d` `Go through the motions but don't write any files``
` `` `-z` `res Resolution of created calibration curves (default 256)``
` `` `-s` `smoothing Extra curve smoothing (default 1.0)``
` `` `-A "manufacturer"``Set the manufacturer description string``
` `` `-M "model"``Set the model description string``
` `` `-D "description"``Set the profile Description string` `
` `` `-C "copyright"``Set the copyright string``
` `` `-x# percent` `Set initial maximum device % target (override auto)``
` `` `-m# percent` `Set initial dev target to % of auto maximum``
` `` `-n# deltaE` `Set initial white minimum deltaE target``
` `` `-t# percent` `Set initial 50% transfer curve percentage target``
` `# = c, r, 0 First channel``
` `m, g, 1 Second channel``
` `y, b, 2 Third channel``
` `k, 3 Fourth channel, etc.``
` `` `-a` `Create an Adobe Photoshop .AMP file as well as a .cal``
` `` `prevcal` `Base name of previous .cal file for recal or verify.``
` `` `inoutname` `Base name of input .ti3 file, output .cal file`

### Options

-v Turn on verbose mode. Gives progress information as the calibration is created. An argument greater than 1 increases the verbosity. An argument of 2 or greater will also dump various curve values. Setting verbose will report the ideal power value to apply to the test chart in targen.
-p Turns on plot mode. This causes various graphs to be plotted as the calibration is created. The channels will be plotted in the graph colors: Blue, Red, Yellow, Black, Green, Purple, Brown, Orange, Grey, White. Using -p 2 will display extra graphs, such as relative to absolute Delta E equivalence, and fit of the raw measurement data.
-w Save colorant 3D plot to inoutname_r.x3d.html and inoutname_c.x3d.html. The first plot is the uncalibrated colorant response, with each cone representing a 5% increment of raw device values. The second plot is the calibrated and maximum device value limited response, with each cone representing 5% increments of the calibrated device values. Both these plots are in L*a*b* space.
-i Select initial calibration mode. Initial calibration mode allows setting the targets for the calibration, such as maximum device percentage, minimum white level, and the transfer curve shape. The second last parameter prevcal is not used in this mode.
-r Turns on re-calibration mode. This is used for calibrations after the initial one, where the aim is to return the devices response to the same state as it was after the initial caibration. Parameters that affect the calibration targets are ignored. The second last parameter prevcal is used to establish what the targets for the calibration are.
-e Turns on verify mode. In this mode the test chart input is verified against the expected response in the prevcal file. This means that the test chart has to be printed with the calibration curves active in the workflow. Note that if a calibration is created that sets any -n# deltaE parameters, then a verification will probably fail, since the trajectories of each ink from a non-white media color were not actually measured in the initial calibration.
-I Similar to -i, except that rather than creating a linear target curve and corresponding calibration, it takes the given behaviour as an absolute target and create a corresponding set of calibration curves. This .cal can then be used to recalibrate a similar device (or the same device at some other time) to imitate the behaviour of the initial device. The second last parameter prevcal is not used in this mode. Parameters that affect the calibration targets are ignored.
-d Disables the writing of any files, causing printcal to go through the motions without changing anything.
The -z parameter allows setting the resolution of the created calibration curves.
The -s parameter allows setting smoothing applied to the measured points in creating curves. The default value is 1.0, and increasing this value (say to 1.5, or 2.0 etc.) will increase the smoothness at the cost of accuracy.
The -A parameter allows setting of the device manufacturer description string in the calibration file. The parameter should be a string that identifies the manufacturer of the device being profiled. With most command line shells, it will be necessary to enclose the parameter with double quotes, so that spaces and other special characters are included in the parameter, and not mistaken for the start of another flag or as a final command line parameters. By default no device manufacturer description string will be put in the calibration file.
The -M parameter allows setting of the device mode description string in the calibration file. The parameter should be a string that identifies the particular model of device being profiled. With most command line shells, it will be necessary to enclose the parameter with double quotes, so that spaces and other special characters are included in the parameter, and not mistaken for the start of another flag or as a final command line parameters. By default no model description string will be put in the calibration file.
The -D parameter allows setting of the profile description string in the calibration file. The parameter should be a string that describes the device and profile. On many systems, it will be this string that will be used to identify the profile from a list of possible profiles. With most command line shells, it will be necessary to enclose the parameter with double quotes, so that spaces and other special characters are included in the parameter, and not mistaken for the start of another flag or as a final command line parameter. By default no profile description string will be put in the calibration file.
The -C parameter allows setting of the profile copyright string in the calibration file. The parameter should be a string that describes the copyright (if any) claimed on the profile being generated. With most command line shells, it will be necessary to enclose the parameter with double quotes, so that spaces and other special characters are included in the parameter, and not mistaken for the start of another flag or as a final command line parameters. By default no copyright string will be put in the calibration file.
The -x parameter allows overriding the default auto maximum device target value computed from the raw device response for the initial calibration. The default uses a heuristic to decide when the response of the device to each channels colorant value reaches the point of diminishing returns, while the -x parameter allows this default to be overridden. The -x parameter can be used multiple times, once for each channel that is being set. The -x should be followed by the channel number between 0 and 15, or the aliases r, g or g, or c, m, y or k, and the channel number should then be followed by the device value as a percentage. NOTE that you will probably get sub-optimal results if you force a device maximum that is beyond the point of maximum response of a device channel, since this will have the effect of reducing the device response. If you want to set a conservative target to allow for recalibration later, see the -m flag below.
The -m parameter allows modifying the default auto maximum device target value for the initial calibration. The auto maximum is computed as described above, and is then scaled by the -m parameter value. Typically this will be a scale down (ie. 90%) to allow some margin to increase the channel value if the channel density drops in a future recalibration. Scaling the maximum down will reduce gamut, but allows scope for stable behaviour using calibration. The -m paramater can be used multiple times, once for each channel that is being set. The -m should be followed by the channel number between 0 and 15, or the aliases r, g or g, or c, m, y or k, and the channel number should then be followed by the deltaE value.
The -n parameter allows overriding the default minimum deltaE of a colorant to white of 0. This can be used to set a minimum colorant level in order to emulate media darker or of a different tint. The -n paramater can be used multiple times, once for each channel that is being set. The -n should be followed by the channel number between 0 and 15, or the aliases r, g or g, or c, m, y or k, and the channel number should then be followed by the deltaE value.
Note that setting a minimum deltaE will probably lead to some degree of mismatch when attempting to verify a calibration, since the trajectories of each ink from a non-white media color were not actually measured in the initial calibration.
The -t parameter allows setting a target linearization curve that is other than purely visual linear. The default is to create a calibration curve that results in a perfectly even change in output for each change in the calibrated device value, as measured by steps in delta E94. The -t parameter allows setting a target curve above or below the perfectly visual linear, by setting the aim value at 50% input. An aim higher than 50% will cause that channel to become more intense by the 50% mark, while a value lower than 50% will cause the channel to become less intense by the 50% mark than perfectly linear.The -t should be followed by the channel number between 0 and 15, or the aliases r, g or g, or c, m, y or k, and the channel number should then be followed by the device value as a percentage.
-a Creates an Adobe Photoshop .AMP format curves file as well as a .cal.
The optional second last parameter is the file base name for a previous .cal calibration file, used as the target reference for recalibrate and verify modes.
The final parameter is the file base name for the .ti3 input test point data, and the resulting .cal calibration file output.

### Discussion

Printcal is a tool for creating per device channel linearization curves for printing devices.
As input it takes a .ti3 file containing the results of printing a test chart on the non-color managed, non-calibrated device, and measuring it. The test chart should consists of step wedges for each of the device primary colors, from the media white to full individual colorant intensity.
For the initial calibration (-i), the range of device values to be used and the shape of the target linearization curve are established, as well as creating the first set of calibration curves. For subsequent re-calibrations (-r), the calibration curves aim to reproduce the same response as the original calibration. If a test chart is printed with calibration enabled in the worklflow and then is measured, it can be used to verify the calibration against the expected response (-e).
As each colorant steps through the test wedge patches from media white, they trace out a measured locus in CIE L*a*b* colorspace. Each channel response is evaluated by computing the CIE DeltaE to media white of the response to a change in each individual channel of each locus. This measure is used to determine when the devices response to a colorant level is reaching diminishing returns, setting a maximum colorant value. This measure can also be used to set a minimum colorant value for the purposes of emulating a different media color. The default maximum and minimum values for each colorant can be overridden using the -x and -n parameters. The automatically determined maximum may be modified (scaled) using the -m parameter, which can be useful in allowing some margin for future calibrations to compensate for a drop in density.
The actual linearization uses a subtly different measure, which is the CIE DelataE 94 along each colorant response locus, ensuring that after linearization each step in colorant value is subjectively even. The linearization aim can be altered from a purely linear curve by using the -t parameters.
After the initial calibration, the device can be re-calibrated (-r) by printing a calibration test chart under the same conditions as the initial one, but with the calibration aimed at reproducing the same response as the initial calibration, rather that setting new targets.
The calibration can be verified (-e) by printing a calibration test chart on non-color managed, but calibrated device, the verification evaluating any discrepancy between the device response achieved, and the device response expected. For a numerical evaluation the verbose flag (-v) should be used, and for a visual evaluation the plot flag (-p) should be used. Note that if a calibration is created that sets any -n# deltaE parameters, then a verification will probably fail, since the trajectories of each ink from a non-white media color were not actually measured in the initial calibration.
If there are several devices of the same or similar model, then one device can be used to set the initial calibration target, and then the other devices can be re-calibrated against the same .cal file, to create matching responses.
An alternative to creating an initial linear target for calibration, is to use the -I option with an initial device, which sets the initial target to be that devices absolute response. Naturally the corresponding calibration will be linear (null). The calibration target can then be used with a recalibrate to return that device to its initial response, or to make another similar device have the same response. Note though, that bad things will happen if the imitated devices response is non-monotonic, or if on re-calibration the device is unable to reach the same density levels.