cctiff
Author: Graeme Gill

## imdi/cctiff

### Summary

Color convert a TIFF or JPEG file using a sequence of compatible ICC device profiles, abstract profiles, device link profiles and calibration files. The sequence may be zero length, facilitating format conversion and ICC profile embedding without otherwise altering the pixel values.

### Usage

cctiff [-options] { [-i intent] profile.icm | [-d dir] calibration.cal ...} infile.tif outfile.tif
-v Verbose
-c Combine linearisation curves into one transform
-p Use slow precise floating point conversion, rather than fast integer routines.
-k Check fast result against precise, and report differences.
-r n Override the default CLUT resolution
-t n Choose output encoding from 1..n
-f [T|J] Set output format to Tiff or Jpeg (Default is same as input)
-q quality Set JPEG quality 1..100 (Default 80)
-a Read and Write planes > 4 as alpha planes
-I Ignore any file or profile colorspace mismatches
-D Don't append or set the output TIFF description
-e profile.[icm | tiff | jpg] Optionally embed a profile in the destination TIFF or JPEG file.
This may be an ICC file or TIFF or JPEG file with embedded profile.
Then for each profile in the linked sequence:
-i intent Profile intent
p = perceptual, r = relative colorimetric,
s = saturation, a = absolute colorimetric
-o order n = normal (priority: lut > matrix > monochrome)
r = reverse (priority: monochrome > matrix > lut)
profile.[icm | tiff | jpg] A Device, Link or Abstract profile. This may be an ICC file
(May be embedded profile in TIFF or JPEG file)
or each calibration file in sequence:
-d dir Calibration direction
f = forward cal. (default), b = backwards cal.
calibration.cal A calibration file.
Then finally:
infile.tif A TIFF or JPEG Raster file that will be the input raster to be transformed.
outfile.tif A TIFF or JPEG Raster file created from the input raster, using the given color transform.
Examples
Convert an RGB file to a CMYK file using perceptual intent:
cctiff -ip sRGB.icm -i cmyk.icm rgbinfile.tif cmykoutfile.tif
Same as above, but use the source file embedded profile, and embed the resulting colorspace profile in the output:
cctiff -e cmyk.icm -ip rgbfile.tif -ip cmyk.icm rgbinfile.tif cmyout.tif
Convert a raster file using a device link:
cctiff devicelink.icm infile.tif outfile.tif
Convert an RGB source to CMYK via an abstract adjustment, and then convert the CMYK to CMYK using a device link, also apply CMYK calibration:
cctiff -ir sRGB.icm abstract.icm -ir CMYK.icm devlink.icm CMYKcal.cal infile.tif outfile.tif
Convert an RGB source file into a CIELab raster file:
cctiff -t1 -ir sRGB.icm rgbfile.tif labfile.tif

### Comments

The -v flag reports extra information about the ICC profile.
The -c, -p, -k and -r options are intended to aid debugging.
-t Some colorspaces can be encoded in more than one way. If there is a choice, the choice should be specified the -t parameter. If this parameter is not given, then cctiff will print the possible choices and choose the default. For TIFF LAB output there are two choices 1 for CIELab encoding (Default), and 2 for ICCLab encoding. For JPEG RGB output there are two choices: 1 for YCbCr encoding with sub-sampled Cb and Cr (Default)\n", and 2 RGB encoding which does not use sub sampling. For JPEG CMYK output there are two choices: 1 for YCCK encoding with sub-sampled C and C (Default)\n", and 2 CMYK encoding which does not use sub sampling
-f By default the output raster file format will be the same as the input, and the -f parameter will override this. -f T will select TIFF format output, and -f J will select JPEG format output.
-q JPEG raster files use lossy compression, and the -q parameter controls how much compression is used in creating a JPEG output file. The value can be between 1 and 100, with 1 being the lowest quality and highest compression, and 100 being the highest quality and lowest compression. The default value is 80.
Normally colorspaces that have more than 4 channels will be read and written as multichannel TIFF files. These are not handled well by all applications, so the -a option causes extra channels above 4 to be stored as alpha planes, providing more flexibility in using such files.
The -I flag causes any mismatch between the color spaces of the image files and each profile in the sequence to be ignored. The results might be unpredictable unless you know exactly what you are doing.
The -D flag stops the description tag being set or appended to by cctiff.
The -e profile.[icm | tiff | jpg] option allows an ICC profile to be embedded in the destination TIFF or JPEG file. The profile may either be an ICC file or a TIFF or JPEG file with embedded profile.
Following these global options, you should specify the chain of profiles and calibrations you want to apply. Each link of the chain consists of the (optional) intent to be used for device profiles and the filename of the profile, or the optional direction to be used for the calibration and the filename of the calibration. The first profile or calibrations input colorspace must be compatible with the input TIFF file, and each profile or calibration output space must be compatible with the next profile or calibrations input space. An error will result if this is not the case.
The -i parameters selects the intent for the following device profile. Normally the same intent should be used for all device profiles, but other combinations allow special uses such as mixed proofing workflows.
The -o parameter changes the order the profiles tags are searched in. 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. -o r reverses this order.
The file that will be the source of the ICC profile. This can be either an ICC profile or a TIFF or JPEG file that contains an embedded profile. Typically the first profile in the chain might be taken from an embedded profile from the source TIFF or JPEG file.
The -d parameters selects the direction for the following calibration. The default direction is the normal forward calibration, but if -db is used, then a backwards (inverse) calibration will be applied.
The file that will be the source calibration. This will be an Argyll .cal format file.
The second last argument should be the name of the source TIFF or JPEG file that is to be processed.
The last argument should be the name of the destination TIFF or JPEG file to hold the results.
cctiff uses very fast integer conversion routines to process the raster. Both 8 and 16 bit per component files can be handled, and up to 8 color channels (The limit can be lifted to 15 re-compiling). JPEG files with no more than 8 bit per component can be handled.