Blog about software development


SVG editing without Illustrator or Inkscape

19 Jul 2016 - by 'Maurits van der Schee'

In order to make your HTML5 games responsive you may choose to create vector graphics in SVG. The commercial Adobe Illustrator and open-source Inkscape software can both be used for this job. I did not like these tools and decided to create my own tool that stays very close to the W3C specification for SVG and allows for high precision editing.

Writing SVG by hand

Instead of using Inkscape I found myself writing SVG by hand using nothing more than a text-editor and a browser. This was mainly because I did not like the verbose Inkscape output of the SVG and that I had trouble making my vector drawings properly symmetric and properly smooth by having symmetric control points on connecting lines.

SVG path types

The most complex SVG vector part is the SVG path. It allows for the following path types:

The commands for the above path types all do not specify the start point as this is the end point of the previous command and the first command must be a "move" command.

NB: The above commands all have a "relative" variant where the coordinates are specified as offsets related to the end point of the previous vector instead of absolute coordinates.

A simple SVG path tool

I decided to create a drawing tool that helps you build SVG using a graphical editor. The difference with Inkscape is that it focuses on creating perfect SVG paths. By showing the actual commands used it gives you more control over the vectors you are drawing. I feel a "perfect" SVG path is the shortest path specifying the shape, using symmetric control points where possible. The coordinates should be rounded (preferably to multiples of 10) and the coordinates should be symmetric where possible. By controlling the cursor with the keyboard instead of the mouse it focuses on precision.

Try the SVG draw tool online!

Source code

This is a very ambitious project, but I started it nevertheless and although it is not finished yet, it may already be useful. I have put it on my Github and I would very much like contributions that help the tool to achieve the above goals.

PS: Liked this article? Please share it on Facebook, Twitter or LinkedIn.