Blog Post RSS ?

Blogs » PHP » ASCII diagrams to image
 

ASCII diagrams to image

by Harry Fuecks

In:


    +---------+         +---------+     +---------+
    |  Shape  |         |  Line   |     |  Point  |
    +---------+         +---------+   2 +---------+
    | draw    +<--------+ start   +----O+ x       |
    | move    +<-+      | end     |     | y       |
    +---------+   \     +---------+     +---------+
                   \
                    \   +---------+
                     +--+ Circle  |
                        +---------+
                        | center  |
                        | radius  |
                        +---------+

Out:

UML from ASCII

Seems this is a to-be-released feature of docutils (Python) called aafigure – source available here – also see the README before and after. To install you’d need Python + PIL – after that download the various .py files from here and run aafigure.py --help from the command line. Able to generate svg, png or jpg.

Very cool. It’s not yet quite so clever to handle any old diagram from JavE, which doesn’t necessarily produce clean lines (depends on the drawing tools you used) and Iñtërnâtiônàlizætiøn is problem but this would be very handy for wikis and similar. Just needs porting to PHP…

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Ping.fm
  • Twitthis

Related posts:

  1. 5 Slick Alternatives To Google Image Search Google's Image Search is always a stalwart when it comes...
  2. Open Source Image Editors … for Designers? Can a designer use an open source image editing application...
  3. 19 Impressive Online Image Editors There's no reason image editing should break your budget, or...
  4. Drawing In Illustrator, Part 4: Pen Tool – Straight Lines Jennifer shows you there is nothing to be afraid of...
  5. How To Resize An Image In Photoshop And Keep It Sharp Knowing which options to choose in Photoshop's Image Size dialog...

This post has 12 responses so far

Sponsored Links

SitePoint Marketplace

Buy and sell Websites, templates, domain names, hosting, graphics and more.

Follow SitePoint on...