Name

pssvg — 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.

The program will read from stdin if a file is not specified as the final argument, and write to stdout if the -o 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.

-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 "gradient-%03i" will produce ids "gradient-001", "gradient-002", ...

-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) .