And now, for something completely different.
For a coming event we want to use logos from different bars and cafes around the block. The idea is to do a little of propaganda: banners, t-shirts, mugs all the way!
Some bars have their fancy logos already as a vector image. Other ones don’t even have a computer where the logo is stored.
In this post we’ll see how to create a vector file from a pixmap (jpg, png, whatever raster format that Inkscape can open). With a couple of examples, a graceful one and a crazy one.
There’s a lot of manuals online for this, an in-depth one with good examples can be found in Tavmjong Bah’s website.
Inkscape is an open-source vector graphics editor, and as the title implies, this is the tool that I’ll use to vectorise the logos.
The tracing tool for Inkscape is based the Potrace, it won’t hurt you to know that this is what we’ll be using.
The steps are common for any vectorization we might want to do.
- Open the image in Inkscape
- Open the Trace Bitmap Tool
- Play around the Trace Bitmap options
- Run the tracing
- Clean up the results (if necessary)
Note the “playing around” part. I’m not an expert on tracing, so I treat this tool as a black box with knobs and lights, twisting and changing until I get the best result.
Vectorising the Debian logo
As an easy example I’ll grab the classic Debian logo and pass it through Inkscape.
This example is even boring. Given that the input image has a enormous size and resolution the vectorization is a success:
In the screenshots it’s difficult to appreciate. But the left image is a PNG of the Debian logo, the right image, a set of points and curves:
Vectorising a logo from a stamp
The stamp may prove more troublesome. Being a stamp, It is full of jitter, places with no ink, and to add injury, I just took a photo of it. You can judge for yourself, but it seems to be some kind of jar with pickled stuff in it.
The first step I perform is to trace using a full color tracing. This creates a layer for each color (or similar), resulting in a good amount of layers.
From the set layers I can just remove the background layers (white, whiteish) ending with a simpler version of the logo.
Once I have a set of layers that resemble the logo, I paint them all the same color (black in this case) to easily discern the shape that its taking.
To avoid working with so many layers, we’ll join the result into a single united layer. To do so, select all the layers and run the
Now we finally have something half useful. But until here everything was automatic. Now it comes to the painful realization that the logo is not clean at all, and it needs tweaking. This tweaking is performed manually with some time of work. For this case I just used different polygons created with the
Beizer curves tool, and joined (
Path->Union) or subtracted (
Path->Difference) from my shape until I was happy with the result.
I have to say, this was possible thanks to the logo being simple. Other logos would be more difficult to vectorize if you don’t have a decent source image.
Inkscape tracing tool is very capable, easy to pick up and use. But there’s a limit on what an algorithm can do, try to obtain high resolution raster images and the tracing will get better. From bad images, you can’t avoid working 😀
One response to “Vectorize an image using Inkscape”
Pingback: The dropped posts, and 2017 closing | Castells