SVGX(1)
π 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:
- the default β just extract the first gradient found in the file
--listβ list the names of all the gradients in the file--selectβ extract the gradient with the specified name--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 theen_US.utf8locale 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--outputoption gets interpreted as the output directory. ποΈ-b,--background rgbβ set the background colour ofcptoutput.
note that this only modifies the"background"field in the output cpt file. it does not affect the transparency (see the--transparencyoption 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 ofplain,xmlorjson.--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 thecptutilspackage) in the output file.-f,--foreground rgbβ set the foreground colour ofcptoutput.-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 ofcptoutput.-o,--output pathβ write the output topath, rather thanstdout.
if the--alloption is specified then thepathargument 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--geometryoption.--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--listoutput for a list of possible values.-t,--type formatβ set the output format, which should be one ofcpt,css3,ggr,gpt,map,psp,pov,png,qgs,saoorsvg.-T,--transparency rgbβ when converting to a format which doesn't support transparency, replace the transparency with the specifiedrgbcolour.-v,--verboseβ verbose operation. she'll tell you everything. π£οΈ-V,--versionβ version information.-z,--z-normaliseβ normalise the z-values in thecptoutput into the range0/1and add aRANGEdirective. 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 thecptoutput: the colour-model code is uppercase, and the colours are separated by spaces.
this is incompatible with the-5and-6options, 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 thecptoutput: 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-4and-6options, of course.
-6,--gmt6β as the-5option, but allows theHARD_HINGEandSOFT_HINGEdirectives in place of the explicitHINGE =directive.
this is incompatible with the-4and-5options, 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
- fedora 43: cptutils 1.82-4.fc43 Β· GPL-2.0-or-later
- fedora 44: cptutils 1.82-6.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms