Shrinking SVG (Again)

From: Jürgen Purtz <juergen(at)purtz(dot)de>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Shrinking SVG (Again)
Date: 2019-11-17 09:28:09
Message-ID: af4a422b-b456-f381-a3f1-321e9ba805bb@purtz.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Our current policy says that we use the two tools Graphviz (drawing
Graphs) and Ditaa (drawing ascii art) to generate SVG. The two tools are
highly specialized and bound to their original purpose. I strongly
believe that we will not be able to visualize more complex situations
like this
http://1.bp.blogspot.com/--CG_kXBFWzw/UgW5JROpbDI/AAAAAAAAAHc/9V8iwO1qluQ/s1600/arch.bmp
or that:
https://severalnines.com/sites/default/files/blog/node_5266/image5.jpg
without using other tools, which are more flexible.

In the past, we had many discussions on this topic and didn't come to a
final decision in favor on one single or a few number of such tools.
However, we came to the important and very helpful conclusion to store
two files per graphic: the original tool-specific (simple to read,
diff-able) and the generated SVG version.

Out in the wild there is the open source tool SVGO
https://github.com/svg/svgo. Its purpose is the generation of a small,
easy to read SVG file out of any other SVG file by removing all the
clutter, tools typically generate. In my opinion it's not perfect, but
it has some strong advantages: the generated files are really small and
nearly free of unnecessary information; it is flexible because a lot of
parameters control the degree of optimization; it is extensible: missing
features may be added by ourselves.

The SVGO tool is a node.js application. At Ubuntu you can install it:
  sudo apt install npm nodejs
  sudo npm install -g svgo
run it, e.g.:
  svgo test1_ink.svg --pretty --indent=2 --precision=2 --multipass
--disable=removeComments  \
                     --output test1_svgo.svg
Please test it with your own examples.

In contrast to our previous policy the generated file is the diff-able,
whereas the original one is hard to read.

Jürgen Purtz

Attachment Content-Type Size
test1_ink.svg image/svg+xml 6.6 KB
test1_svgo.svg image/svg+xml 1.8 KB

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Yasuhiro Horimoto 2019-11-18 07:21:05 Re: I suggest improving install steps for CentOS 8
Previous Message Liudmila Mantrova 2019-11-16 21:04:59 GSoD - a patch for Getting Started tutorial