labs / diagrams_source / README.txt
This is where we put the original versions of images so that we can update them if needed.

_opt versions of the files are compressed/optimised and are the versions that are embedded in the Wiki.

Optimizing SVG files:

svgcleaner seems to be the best tool for reliably shrinkifying SVG files (does a better job of using groups to apply shared styles than scour):

Available in Arch as community/svgcleaner.

Run using:

svgcleaner --multipass --coordinates-precision 3 --properties-precision 3 --transforms-precision 3 --paths-coordinates-precision 5 file.svg file_opt.svg

if you want the output in a human readable form so that it can be hand-tweaked, the best bet is xmlstarlet (svgcleaner can indent, but it doesn't always put line breaks where you need them):

cat file_opt.svg | xmlstarlet fo

Once tweaked, you can use the following to strip the indentation:

cat file_opt.svg | xmlstarlet fo -n | tr -d '\n' > final.svg

Optimising PNG files:

oxipng seems to be the best of the commonly available PNG optimisers.  It has support for Zopfli which generally offers better compression than zlib.

Available in Arch as community/oxipng.

Run using:

oxipng --strip safe --alpha --zopfli -o max --out file_opt.png file.png