Loading...
Searching...
No Matches
Writing SVG files

Automatical generation of SVG files

Rack supports presenting generated PNG images collectively using Scalable Vector Graphics (SVG) format.

When executing Rack, all the PNG images that have been written with --outputFile / -o are included automatically in an internal SVG structure.

The structure is always created in the background but written out only if explicitly asked to, with --outputFile file.svg command. Typically, that command is executed last.

The internal SVG structure is lightweight, so maintaining it in the background is neither time nor memory consuming. In addition, some processing - like alignment of elements - takes places only if an SVG file is actually written out.

Examples of SVG panels

Alignment of the elements is done horizontally or vertically. By default, images are positioned horizontally, from left to right. This can be changed with --gLayout , selecting orientation as HORZ or VERT and coordinate direction as increasing (INCR ) or decreasing (DECR ).

The resulting SVG file can be converted to various other image formats using ImageMagick's convert program, for example. A good alternative is inkscape .

Relative or absolute image file paths?

In SVG files, IMAGE elements may use either relative or absolute file paths. By default, Rack uses absolute paths in IMAGE elements. Should relative paths be used, simply use them on commandline, or use --outputPrefix $PWD/ together with --outputConf svg:absolutePaths=false .

Some considerations:

  • If an SVG file is to be placed on an HTML page, file references of IMAGE elements must be relative – HTTP servers typically avoid revealing any system-side paths, hence do not support them in openly adressing files.
  • ImageMagick's convert and display programs seem to require absolute paths in filenames.
  • Inkscape program supports both

With Rack , SVG files can also be created using templates, see Formatting metadata output using templates .