SVGX(1)

πŸ“¦ version 1.82, in fedora 43, fedora 44

πŸ’… svgx(1) β€” User commands, but make it iconic ✨

okay bestie, listen. this is the manual page for svgx, a little program that lives in section 1 of your man pages (the "User commands" girlies), and she is specifically about pulling gradients out of SVG files. no cap. πŸŽ€


🌈 NAME 🌈

svgx β€” extract gradients from SVG files. that's it, that's the whole job, and she does it beautifully. πŸ’–


✨ 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

the path at the end? mandatory. she needs her file, bestie, she's not guessing. πŸ™ˆ


πŸ¦‹ DESCRIPTION πŸ¦‹

so svgx extracts and converts the gradients inside an SVG file. now here's the thing that makes her different from her siblings β€” unlike most of the other file formats the cptutils package handles, SVG files can hold multiple gradients at once. so this program operates a lil differently to the rest of the family. she's got range. πŸ‘‘

there are 4 modes of operation:

  1. the default β€” just extract the first gradient found in the file
  2. --list β€” list the names of all the gradients in the file
  3. --select β€” extract the gradient with the specified name
  4. --all β€” extract all of the gradients

you pick the output format with the --type option (see below). and actually, there are several aliases for each format β€” jgd for psp, ggr for gimp, and so on. iykyk. πŸ’…

also, the svgcpt, svgcss3, svggimp, svggpt, svgmap, svgpg, svgpsp, svgpov, svgpng, svgqgs, svgsao and svgsvg programs are all just wrappers around svgx that use the --type switch to specify the output type. they're the entourage. ✨

atypically, the input SVG file is a mandatory argument. like, she's not gonna go find it for you. 😭 the program writes to stdout if you don't specify -o... except when -a has been specified β€” then files get produced (with names taken from those of the gradients). girlie makes her own filenames, respect it.

note that some of the SVG conversions require the en_US.utf8 locale to be enabled. how you do that depends on your OS. on Debian-based systems, for example, you'd run: text apt-get install locales dpkg-reconfigure locales

slay. πŸ’–


πŸŽ€ 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. got it? write it down. πŸ“

  • -a, --all β€” extract all the gradients, and they'll have filenames derived from the gradient names. if you use this option, then the argument of the --output option gets 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 for that, bestie).
  • --backtrace-file path β€” specify a file to write a formatted backtrace to. the file will only be created if there's actually a backtrace created β€” typically when an error occurs. so if everything's chill, no file. 🧘
  • --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 (the program adds those itself, she's helpful like that πŸ’…).
  • --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 the 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. no making up directories out of thin air. 🫢
  • -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, and do not create Tecplot maps with more than 50 points. she's on her best behaviour. πŸ˜‡
  • -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 doesn't support transparency, replace the transparency with the specified rgb colour.
  • -v, --verbose β€” verbose operation. she'll tell you everything. πŸ—£οΈ
  • -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 the 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. obviously. πŸ’€ 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). future-proof yourself, bestie.
  • -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.

🌸 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 β€” and note that the gradient name needs to be quoted, girlie has a space in her name so you gotta respect that:

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

kittens with previews. she ate that. 🐱✨


πŸ™ˆ CAVEATS πŸ™ˆ

an ill-formed SVG gradient may be translated to rubbish while not reporting an error. yes really. she's doing her best but she's not a miracle worker. 😭

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 β€” you lose the cpt range information, whereas 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. it's not a bug, it's a whole personality. πŸ’…


πŸ‘‘ AUTHOR πŸ‘‘

J.J. Green


πŸ”₯ SEE ALSO πŸ”₯

cptsvg(1), gimpsvg(1), pspsvg(1).


and that's the whole page, bestie πŸ’– this was from cptutils 1.82, dated 9 July 2024 β€” go forth and extract those gradients, you absolute main character πŸ¦‹βœ¨πŸ‘‘

πŸ“¦ where this page comes from