svgx - Man Page
extract gradients from SVG files.
Synopsis
svgx [-a] [-b rgb] [-f rgb] [-g geometry] [-h] [-l] [-n rgb] [-o path] [-p] [-s name] [-t type] [-T rgb] [-v] [-V] [-z] [-4] [-5] [-6] path
Description
The svgx program extracts and converts gradients in an SVG file. Unlike most of the other file formats handled by the cptutils package, SVG files may contain multiple gradients, so this program operates a little differently to the other programs in the package.
There are 4 modes of operation: The default is to extract the first gradient found in the file, or one can specify --list to list the names of all gradients in the file; --select to extract the gradient with the specified name or --all to extract all of the gradients.
The output format is specified by the --type option as listed below (in fact there are several aliases for each format: jgd for psp, ggr for gimp and so on). The svgcpt, svgcss3, svggimp, svggpt, svgmap, svgpg, svgpsp, svgpov, svgpng, svgqgs, svgsao, svgsvg programs are wrappers around svgx which use the --type switch to specify output type.
Atypically, the input SVG file is a mandatory argument. The program will write to stdout if the -o option is not specified except when -a has been specified: then files will be produced (with names taken from those of the gradients).
Note that some of the SVG conversions require that the en_US.utf8 locale be enabled. How this is done will depend on your operating system. One would run
apt-get install locales dpkg-reconfigure locales
on Debian-based systems, for example.
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.
- -a, --all
Extract all gradients, which will have filenames derived from the gradient names. If this option is used then the argument of the --output option will be interpreted as the output directory.
- -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 --transparency 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.
- --comments-read path
Read the comments from the specified path and add them to the output gradient.
The format is simply a plain text multi-line document without any comment delimiters (those will be added by the program).
- --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.
- -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
Brief help.
- -l, --list
List the names of all gradients in the file.
- -n, --nan rgb
Set the NaN (no data) colour of cpt output.
- -o, --output path
Write the output to path, rather than stdout.
If the --all option is specified then the path argument must be a directory (which exists) and the output files will be written into this directory.
- -p, --preview
Include a preview in the SVG output. See also the --geometry option.
- --strict
Do not create files which break limits of the format specification. In particular, do not create POV-Ray headers with more than 255 stops, do not create Tecplot maps with more than 50 points.
- -s, --select name
Extract the gradient with the specified name, see the --list output for a list of possible values.
- -t, --type format
Set the output format, which should be one of cpt, css3, ggr, gpt, map, psp, pov, png, qgs, sao or svg.
- -T, --transparency rgb
When converting to a format which does not support transparency, replace the transparency with the specified rgb colour.
- -v, --verbose
Verbose operation.
- -V, --version
Version information.
- -z, --z-normalise
Normalise the z-values in the cpt output into the range 0/1 and add a RANGE directive. This is the form used in GMT master files.
This option requires that output cpt version is at least 5.
- -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.
- -6, --gmt6
As the -5 option, but allows the HARD_HINGE and SOFT_HINGE directives in place of the explicit HINGE = directive.
Examples
Inspect an SVG file for gradients:
svgx -v -l old.svg
Extract the gradient "Sunny Road" from the same SVG file, converting the result to cpt: (note that the gradient name needs to be quoted)
svgx -v -t cpt -s "Sunny Road" -o sunny_road.cpt old.svg
Extract all of the svg gradients from the file kittens.svg and give each of them a preview:
svgx -v -t svg -a -p kittens.svg
Caveats
An ill-formed SVG gradient may be translated to rubbish while not reporting an error.
When converting between types in several calls to different programs, one should note that the SVG format preserves the alpha channel, but will coerce the range to [0, 100]. So converting from cpt to pg via cptsvg and svgpg one loses the cpt range information, while using cptpg will perserve it. Conversely, converting SVG to pg via svgcpt and cptpg will lose the alpha channel, while svgpg will not. This is the reason for the apparent duplication of functionality in the package.
Author
J.J. Green
See Also
Referenced By
gimplut(1), gimpsvg(1), pspsvg(1), pssvg(1), qgssvg(1).
The man pages svgcpt(1), svgcss3(1), svggimp(1), svggpt(1), svgmap(1), svgpng(1), svgpov(1), svgpsp(1), svgqgs(1), svgsao(1) and svgsvg(1) are aliases of svgx(1).