Ads by Google

Saturday, November 22, 2008

Converting your Ascii art to PNGs

If you use org mode, in the contrib/scripts folder of the package you'd find a jar file called ditaa.jar. This is a small piece of software which requires Java (drat!) but nevertheless a neat one.

For those of you who know Artist-mode in Emacs, this would be a god send. Instead of the ASCII pictures that you send in your emails, the same ASCII can be converted to PNG images and sent across. Here's a sample of what I did; albeit a nonsensical one.

First I drew this ascii text of 2 rectangles by invoking M-x artist-mode and drawing them using the rectangle option.



I saved the text file and called the program thus

$ java -jar ditaa.jar ../../temp/aa.txt

DiTAA version 0.6b, Copyright (C) 2004 Efstathios Sideris

Using options:

Reading file: ../../temp/aa.txt


Rendering to file: c:\..\..\temp\aa.png


Done in 5sec


$


I did that in my cygwin emulation shell in Windows, so it should not be too different in Unix OSes or the DOS prompt.



The homepage of the package is ditaa and it has a good intro on how to use the software. So, it all boils down to learning artist-mode in Emacs and then converting that to PNGs. The package is written by Stathis Sideris and you can contact him for any bugs and features you need. In my opinion, this is one handy piece of software when your rough sketch needs to be seen by all and sundry. For simple database sketches, this will be an excellent tool and another reason to do all your work in Emacs!

No comments: