SVG files in TPC

PET TAC data can be plotted in Scalable Vector Graphics (SVG) format in several tools available for data analysis in Turku PET Centre.

SVG files can be viewed or printed with any up-to-date web browser. LibreOffice can be used to create and edit SVG. Google Docs Drawings can be saved as SVG. Image/graphics editor programs, such as the free Inkscape, can be used to open and edit SVG files.

Alternatively, SVG files can be converted to other graphics formats. Software for viewing GIF, JPG, and PNG formats are available in every computer, and these formats can be added to MS Word and PowerPoint documents. Inkscape GUI can be used to convert SVG to PNG format. If Inkscape is downloaded and installed from inkscape.org (not the version from Microsoft Store), conversion can be done in command-prompt window (shell); for example:

"C:\Program Files\Inkscape\bin\inkscape.exe" --export-type="png" --export-width=1200 --export-background="white" input.svg

For Windows, there is also a batch file svg2png.bat, which can be used to convert one SVG file, or all SVG files in current folder, to PNG format with commands

svg2png input.svg

or

svg2png

, respectively. To further process PNG, JPG or GIF images, install a photo editing software. A free command-line utility ImageMagick® will be handy for automated processing of lots of graphics files. As an example, four PNG images can be joined together into a matrix with two columns and three rows with command

magick montage +frame +shadow +label -tile 2x3 -geometry 100%x100%+0+0 img1.png img2.png img3.png img4.png img5.png img6.png joined.png

Inside Windows batch file you may need to escape the percent signs and call it like this

call magick montage -tile 2x2 -geometry 100%%%"x"100%%%+20+50 img?.png joined.png

In the example above, the '20' and 50' in the geometry parameter sets 20 pixel horizontal and 50 pixel vertical margin between the images.

With ImageMagick you can even make a movie of png (or other format) images, for example:

magick convert -background white -alpha background -delay 100 -size 400x400 xc:white -dispose previous *.png movie.mpeg

For further instructions, see the page on ImageMagick command-line processing.

To make a simple gallery of SVG plots for viewing in web browser, you can use htmlgall; go to the directory where the SVG files are located, and, for example, enter command:

htmlgall gallery.html *.svg

and double-click the created page, gallery.html.


See also:


Literature

Cagle K, Bellamy-Royds A, Storey D: Using SVG with CSS3 and HTML5 - Vector Graphics for Web Design. O'Reilly Media, 2017.

Eisenberg J. Bellamy-Royds A: SVG Essentials - Producing Scalable Vector Graphics with XML, 2nd ed., O'Reilly Media, 2014.

Hiitola B: Inkscape Beginner's Guide. Packt Publishing, 2012. ISBN 978-1-84951-720-1.



Tags: , ,


Updated at: 2026-02-05
Created at: 2011-10-19
Written by: Vesa Oikonen