![]() |
![]()
| ![]() |
![]()
NAMEsvgx - extract gradients from SVG files. SYNOPSISsvgx [-a] [-b rgb] [-f rgb] [-g geometry] [-h] [-l] [-n rgb] [-o path] [-p] [-s name] [-t type] [-T rgb] [-v] [-V] [-z] [-2] [-4] [-5] [-6] path DESCRIPTIONThe 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. OPTIONSIn 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.
In the case that the --all option is selected, then as with the other programs, the number of comments in path should match the number of gradients in the input. However, with the default behaviour (where only the first gradient of the input is selected) or if the --select option is given, again selecting a single gradient from the input, then a comment file with a single comment is required. 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.
-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 ids 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 id, see
the --list output for 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. -2, --svg2 SVG output is version 2.0 of the format. Note that
version 2.0 is not yet completed and browser support is minimal.
-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 the HARD_HINGE
and SOFT_HINGE directives in place of the explicit HINGE =
directive.
This is incompatible with the -4 and -5 options of course. EXAMPLESInspect 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 CAVEATSAn 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 preserve 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. AUTHORJ.J. Green SEE ALSOcptsvg(1), gimpsvg(1), pspsvg(1).
|