pssvg - Man Page

convert Photoshop™ gradients to SVG.

Synopsis

pssvg [-b rgb] [-f rgb] [-h] [-o path] [-t format] [-v] [-V] path

Description

The pssvg program converts Photoshop grd5 gradients to the SVG format. Unlike most of the other file formats handled by the cptutils package, grd5 files may contain multiple gradients and all of the input gradients will be converted to gradients in the output file. One can then use svgx(1) to extract single gradients and convert them to other formats.

Photoshop gradient files will often contain a number of gradients with the same name. These names are used as the basis for the SVG titles (the id attributes), but since these must be unique, the program will append _01, _02, ... to duplicate names in order to form the titles. Alternatively once can employ the --title option to generate a uniform sequence of titles.

Similarly, the output SVG ids must be valid XML ids, in particular they must start with a character (not a number); if the Photoshop gradient names are invalid as XML ids then the program will error. Again, an explicit --title will fix this issue.

The program will read from stdin if a file is not specified as the final argument, and write to stdout if the --output option is not specified.

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 the output.

--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-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 the output.

-h,  --help

Brief help.

-o,  --output path

Write the output to path, rather than stdout.

-t,  --title format

This option generates the SVG gradient titles (the id attributes) according to the specified format.

The format argument should be a printf(3) format string containing a single integer directive (and that directive will be replaced by the gradient number). Thus "id-%03i" will produce ids "id-001", "id-002", ...

Note that passing a format string which does not contain a single integer directive will result in undefined behaviour (in the C sense) so one should only use trusted sources for this string.

-v,  --verbose

Verbose operation.

-V,  --version

Version information.

Example

Convert a Photoshop gradient, foo.grd, to a set of GIMP gradients, foo-001.ggr, foo-002.ggr, ...

pssvg -v -t "foo-%03i" -o tmp.svg foo.grd
svggimp -v -a tmp.svg

Caveats

The program handles RGB, HSB, LAB, CMYK and greyscale colour stops, converting them all to RGB and then merging the results with the opacity channel to create SVG RGBA stops. Conversion of non-RGB stops is naive and takes no account of colour profiles, so the results are generally sub-optimal. Integration of a CMS (colour management system) into the program to perform these conversions is under investigation.

The program does not handle "Book Colours" (PANTONE, COLOR FINDER, etc) for legal reasons.

The SVG output format does not support back/foreground colours; consequently, if the input specifies any stops with back/foreground colours then these will be converted to the colour specified by the --background and --foreground options, respectively.

The smoothness parameter used by Photoshop (which seems to parameterise some kind of spline) is not yet handled; the output contains only linear splines (corresponding to a smoothness of 0%). The result is that the SVG output will sometimes look more "angular" than the Photoshop input. Fixing this will require research into the precise nature of the spline parameterisation used in the input.

Noise gradients would seem to be difficult to convert to SVG without using a huge number of stops in the output, so these will probably not be supported by this program.

Notes

Adobe Photoshop™ is a trademark of Adobe Systems Inc. PANTONE™ is a trademark of Pantone LLC. COLOR FINDER™ is a trademark of Toyo Ink Mfg. Co., Ltd.

This program was written using the reverse-engineered specification of the grd5 format by Valek Filippov, Alexandre Prokoudine and Michel Mariani.

Author

J.J. Green

See Also

svgx(1).

Referenced By

pspsvg(1).

9 July 2024 cptutils 1.82 User commands