cpthsv man page

cpthsv — modify hue, saturation and colour value of GMT colour palette tables.


cpthsv -T transform [-h] [-o file] [-v] [-V] [file]


The cpthsv utility reads the RGB colour palette in the input, converts its colours to the HSV colour-space, modifies these values in some simple ways, then converts back to RGB colour space and outputs a cpt file. So cpthsv can (de)saturate, brighten, darken or hue-shift.

The program will read from stdin if a file is not specified as the final argument, and write to stdout if the -o 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,


--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 of plain, xml or json.

-h, --help

Brief help.

-o, --output file

Write the output to file, rather than stdout.

-T, --transform string

Specify a transformation to perform. One of h, s or v followed by a number and optional operation. The effect of the number depends on the operation: one of x (multiply by number), % (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 applying s1.1x or s110% or s0.05+. If the operator is not given then % is assumed.

Transforms 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, which is taken modulo 360.

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.


Lighten by 10% and desaturate by 20%:

cpthsv -v -T s80,v110 -o new.cpt old.cpt


J.J. Green

See Also



2 Aug 2016 CPTUTILS User commands