Linux.com

Feature

ASCII art fun with boxes

By Shashank Sharma on June 16, 2006 (8:00:00 AM)

Share    Print    Comments   

ASCII art has evolved from flashy text messages cooked up with underscores and hashes to more complex and appealing designs, but creating such patterns takes some effort. boxes is an excellent utility that can help you create interesting ASCII artwork.

On a Debian system, boxes is just an apt-get install away. You can also get the source tar.gz package from the downloads page, along with simple installation instructions.

Using boxes from the command line is a breeze. The syntax is boxes -d <designtype>; the -d switch is for telling boxes the design name. There are a lot of designs available, such as dog, columns, and peek. The examples page has a description of many designs.

As an example, to create ASCII art in columns, type boxes -d columns and press Enter, then write your message. If you need to use multiple lines, just keep hitting Enter wherever required. Once you are done, press Ctrl-d and your ASCII art will be displayed on the screen.

boxes also allows you to describe the size attributes of a design, such as width and padding, using the -s switch. The -a switch can be used to specify the positioning of the text.

A complete list of all supported designs is available at the designs page. All the designs are defined in a config file that resides in /usr/share/boxes/boxes, at least on my Ubuntu system.

In addition to using boxes from the command line, you can also tie it to text editors such as Vim and Emacs to generate things like comments in C code. To integrate boxes with Vim, you need to edit your ~/.vimrc file. As per the installation page, you only need two lines to integrate boxes with Vim:

vmap ,mc !boxes -d c-cmt<CR>
nmap ,mc !!boxes -d c-cmt<CR>

The <CR> should be included in your file. Now, in the visual mode in Vim, when you enter ,mc, the command boxes -d c-cmt gets executed. Alternatively, you can just call a filter from the visual mode by typing ! or !! if you are in the normal mode. When you call a filter, .! appears at the bottom left of the Vim window, and allows you to run the boxes command.

boxes can work on a selection of text or just one line. By default, it operates only on the current line. To select multiple lines, press "v" in the normal mode and then use the arrow keys to make the selection. .!boxes -d dog would create ASCII art where your message, as selected using "v," is displayed on a plaque held up by a dog.

If the ease of creating beautiful artwork inspires you to create your own designs, read through the documentation and get busy!

Shashank Sharma is studying for a degree in computer science. He specializes in writing about free and open source software for new users.

Shashank Sharma specializes in writing about free and open source software for new users and moderates the Linux.com forum boards. He is the coauthor of Beginning Fedora, published by Apress.

Share    Print    Comments   

Comments

on ASCII art fun with boxes

Note: Comments are owned by the poster. We are not responsible for their content.

ascii world cup

Posted by: Anonymous Coward on June 17, 2006 01:03 AM
a propos ascii art...

to every linux admistrator who is missing a live stream of the world cup in his console, watch this:

telnet ascii-wm.net 2006

#

Football world cup in ASCII

Posted by: Anonymous Coward on June 17, 2006 11:53 PM
Try this command to watch world cup 10 minute footage in ASCII: telnet ascii-wm.net 2006
---
Pixel image editor - <a href="http://www.kanzelsberger.com/" title="kanzelsberger.com">http://www.kanzelsberger.com/</a kanzelsberger.com>

#

Re:Duh DRAW

Posted by: Anonymous Coward on June 18, 2006 07:17 AM
actually it's called TETRADRAW<nobr> <wbr></nobr>;)

#

Duh DRAW

Posted by: Administrator on June 17, 2006 09:14 AM
Back in the old BBS days there was a great program called TheDraw which was outstanding for drawing ASCII/ANSI art. You can find it on freshmeat at -


<a href="http://freshmeat.net/projects/duhdraw/" title="freshmeat.net">http://freshmeat.net/projects/duhdraw/</a freshmeat.net>

#

Re:Duh DRAW

Posted by: Administrator on June 17, 2006 09:39 AM
This isn't as clear as it should be. Dhu DRAW is a clone of TheDraw and is available on Freshmeat.

#

I use JavE

Posted by: Administrator on June 19, 2006 05:17 PM
<a href="http://www.jave.de/#description" title="www.jave.de">JavE</a www.jave.de> is the best ASCII art software I have found.

It's not open source, and worse yet, it require Suns Java.

But once you've sold your soul it's great. I used it for a <a href="http://watkin5.net/ascii" title="watkin5.net">composite compopsition</a watkin5.net>.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya