Vectorize an image using Inkscape

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

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.

Vectorising steps

The steps are common for any vectorization we might want to do.

  • Open the image in Inkscape
  • Open the Trace Bitmap Tool Path->Trace Bitmap
  • 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.

Vectorizing Debian Logo

Vectorizing Debian Logo

This example is even boring. Given that the input image has a enormous size and resolution the vectorization is a success:

Debian Logo Vectorized

Debian Logo Vectorized

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:

Debian Logo. It is indeed a vector

Debian Logo. It is indeed a vector

Vectorising a logo from a stamp

A stamp on a paper

A stamp on a paper

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 Path->Union process.

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.

Vectorizing a logo, steps.

Vectorizing a logo, steps.

Conclusions

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 😀

References

Potrace Go
Tavmjong Bah’s Inkscape Manual Go

Advertisements

Leave a comment

Filed under DIY, tools

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s