gradient-convert man page
gradient-convert — convert gradients between formats
gradient-convert [-b rgb] [-B] [-c] [-f rgb] [-g geometry] [-h] [-i format] [-n rgb] [-o format] [-p] [-T rgb] [-v] [-V] [-z] infile outfile
The gradient-convert program converts gradients to other formats. It is a wrapper script which make a number of calls the individual programs from the cptutils package so, for example, to convert an Arcview legend (avl) to a PNG image, the programs avlcpt, cptsvg and svgpng would be called in sequence to generate the required file.
The formats of the mandatory infile and outfile arguments are determined from the file extensions, or can be specified explicitly by the -i and -o options.
In the following, all rgb specifications should be of the form red/green/blue where the colour components are integers in the range 0 to 255.
- -b, --background rgb
Set the background colour of cpt output.
Note that this only modifies the "background" field in the output cpt file, it does not affect the transparency (see the -T option in that regard).
- --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.
- -B, --burst
Some of the file formats handled by cptutils may contain multiple gradients: the Photoshop (grd) and SVG formats for example. By default, the program will extract only the first gradient from such files; but when the --burst option is selected then all gradients will be extracted. In this case the outfile argument must be a directory (and that directory should already exist).
- -c, --capabilities
Print the capabilites of the program to stdout. This data (in YAML format) may be used to autoconfigure other programs which wish to use this program. The format should be self-explanatory.
- -f, --foreground rgb
Set the foreground colour of cpt output.
- -g, --geometry widthxheight
Specify the size of the PNG image or SVG preview in pixels.
- -h, --help
- -i, --input-format format
Specify the format of the input file. Run the program with the --help option for a list of supported formats.
- -n, --nan rgb
Set the NaN (no data) colour of cpt output.
- -o, --output-format format
Specify the format of the output file. Run the program with the --help option for a list of supported formats.
- -p, --preview
Include a preview in the SVG output. See also the --geometry option.
- -T, --transparency rgb
When converting to a format which does not support transparency, replace the transparency with the specified rgb colour.
- -v, --verbose
- -V, --version
- -z, --zip
For input formats which may contain mutliple gradients (grd, svg) the -z extracts all of the gradients and zips them up. Thus it can be veiwed as similar to the burst option (-B). The zipfile to be created should be the final argument and when unzipped it will create a directory (containing the converted gradients) with the same name as the file with the .zip extension removed.
Convert an Arcview Legend to a 200x20 pixel PNG image:
Convert all gradients in a PhotoShop gradient to GMT cpt files in a zipfile:
The component programs in the conversion will generally have a number of options available for modifying the conversion behaviour, but only the most-often used of these options can be passed to component programs from gradient-convert.
Note also that those options which are passed to component programs are not checked for relevance. Converting a GMT cpt file to GIMP format while using using the irrelevant -g option will not cause an error, it will simply be ignored.