

Colours are the deeds of light; its deeds and sufferings: thus considered we may expect from them some explanation respecting light itself.
Synopsis
cpthsv
-T transform
[-h ] [-m model
] [-o path
] [-v ] [-V ] [-z ] [-Z ] [-4 ] [-5 ] [-6 ] [path
]
DESCRIPTION
The cpthsv utility reads a colour palette, converts its colours to HSV (if needed), modifies these values in some simple ways, converts back to the original colour-space (if needed) and writes the result. So cpthsv can (de)saturate, brighten, darken or hue-shift.
Currently, RGB and HSV colour-spaces are transformed, other spaces and fill-types will pass
through without being modified. (The --verbose
option reports the
number of segments transformed.)
The program will read from stdin
if a file is not specified as
the final argument, and write to stdout
if the --output
option is not specified.
The hue value is taken to be between 0 and 360, while the saturation and value components are taken to be between 0 and 1,
OPTIONS
--backtrace-file
path
-
Specify a file to which to write a formatted backtrace. The file will only be created if there is a backtrace created, typically when an error occurs.
--backtrace-format
format
-
Specify the
format
of the backtrace written to the files specified by--backtrace-file
, one ofplain
,xml
orjson
. --comments-read
path
-
Read the comments from the specified
path
and add them to the output gradient.The format is custom XML which should be fairly easy to generate, see the output of
--comments-write
for examples. --comments-write
path
-
Write the comments in the input to the specified
path
. --comments-retain
-
Use the comments in the input file as the comments for the output file.
--comments-generate
-
Create a comment with summary data (the date of creation, name and version of the cptutils package) in the output file.
-h
,--help
-
Brief help.
--hinge
value
-
Specify the z-
value
of the hinge in the cpt file. If there is no hinge directive (i.e., aSOFT_HINGE
orHARD_HINGE
) in the input, then this option has no effect.When normalising (with the
--z-normalise
option), this gives the z-value in the input which is mapped to zero. That z-value must be one of the stops in the input.When denormalising (with the
--z-denormalise
option), this gives the value in the output to which zero in the input is mapped. This option can be viewed as the counterpart to the+h
appended to thevalue
-C
option for the makecpt (1) . --hinge-active
-
If the input cpt has a
SOFT_HINGE
directive, then activate that hinge (resulting in independent scaling of the two halves of the gradient either side of the hinge).If the input does not have such a directive, then this option has no effect.
-m
,--model
model
-
On writing the output, convert all colours to the specified
model
, one of "rgb" or "hsv". This has no effect on non-colour segments. -o
,--output
path
-
Write the output to
path
, rather thanstdout
. -T
,--transform
string
-
Specify a transformation to perform. One of
h
,s
orv
followed by anumber
and optionaloperation
. The effect of the number depends on the operation: one ofx
(multiply bynumber
),%
(scale by percentage) or+
/-
(add or subtract value). An RGB colour with saturation 0.5 would be transformed to one with saturation 0.55 by applyings1.1x
ors110%
ors0.05+
. If the operator is not given then%
is assumed.Transformations which take colours outside the HSV colour-space are permitted, the result is truncation (eg, increasing a saturation of 0.8 with
s0.3+
results in a saturation of 1.0). The exception is hue: if the hues at each end of a segment are both transformed outside the 0–360 range, they are reduced modulo 360; if only one is then the segment is split in two at the boundary (either 0 or 360) and the segment outside 0–360 reduced modulo 360 to bring it back within.Multiple transforms can be applied by separating transforms with commas. This is to be preferred over multiple calls to the program since the conversion between colour-spaces is necessarily lossy. Multiple transformations are applied in the order given in the argument.
-v
,--verbose
-
Verbose operation.
-V
,--version
-
Version information.
-z
,--z-normalise
-
Normalise the z-values in the cpt output into the range 0/1 (or to -1/1 if a hinge is present) and add a
RANGE
directive if not present in the input. This is the form used in GMT master files.This option requires that output cpt version is at least 5.
-Z
,--z-denormalise
-
Set the z-values in the cpt output into the range given by the
RANGE
directive, and remove that directive. If there is noRANGE
then this option does nothing. -4
,--gmt4
-
Use GMT 4 conventions when writing the cpt output: the colour-model code is uppercase, and the colours are separated by spaces.
This is incompatible with the
-5
and-6
options of course.At present this option is the default, but that will change at some point. So specify this option if your use of the output depends on the GMT 4 layout (consumed by a custom parser, for example).
-5
,--gmt5
-
Use GMT 5 conventions when writing the cpt output: the colour-model code is lowercase, and the colours are separated by a solidus for RGB, CMYK, by a dash for HSV.
This is incompatible with the
-4
and-6
options of course. -6
,--gmt6
-
As the
-5
option, but allows theHARD_HINGE
andSOFT_HINGE
directives in place of the explicitHINGE =
directive.This is incompatible with the
-4
and-5
options of course.