Creating Vector Artwork from Raster Scans

A couple of days ago, I got bitten by the bug again to think about trying to actually commit some of my braincells to the learning of some Mayan hieroglyphs, and maybe make a program which actually could draw dates written in the Mayan long count calendar. To do that, I needed some bitmaps of the glyphs. Luckily, if you dig around, you can find a zip file with all sorts of Maya glyphs in it. An example glyph looks like:

Glyph 10500

Not bad, but not exactly pretty either. The resolution is pretty low, and it isn’t even antialiased. I had some idea that I could load this into a program for vector based image editing like inkscape and then trace the outlines, and indeed, if you import the bitmap, you can then use the “Trace Bitmap” function, and turn it into a nice .SVG format vector file. But there are over 1000 glyphs in that catalog, and doing each one separately seemed like it would be a real drag.

A tiny bit more research revealed that inkscape uses the “potrace” library, which you can also install as a standalone command-line program. Woohoo! It accepts simple black and white PBM files (use the netpbm utilities or ImageMagick to convert your gifs to PBM files) and can output in a variety of formats, including Postscript, SVG, or even antialiased PGM files. When I ran potrace on the bitmap above, and wrote out an antialiased pgm file, I got:

Antialiased Glyph 100500

Much nicer. If you have a browser which supports SVG files, you can view it in its native format.

The conversion isn’t always perfect, but it seems to be a darned good start, and you can actually edit the SVG files to fix what minor problems remain.

[tags]Inkscape,Maya,Hieroglyps,Raster to Vector,potrace[/tags]