This week I retweeted a last April tweet I stumbled across:
This looked really interesting to me, graphviz dot tool drawing output "inside" the terminal:
This is possible on the Mac by iTerm 2.
I wanted to be able to do same or similar [of course store as file and view via gimp or browser is possible].
Back in 2011 I gave 2 WSTE webcasts on "Non-XML Data Processing in WebSphere DataPower SOA Appliances Stylesheets". The 2nd webcast shows on slide 28 how I did convert a bitmap image into textual output making use of the Braille Patterns.
This is the conversion for snowman.pbm, .pbm is portable bitmap format from netpbm tools:
Typically only the top 2x3 dots of 2x4 get used, as you can see above I used all 2x4.
Here are the numbering of the dots as well as the hex codes are specifed:
There are tons of converters between different formats in netpbm tools, as well as modifiers (like eg. pnmcrop).
In this blog posting I will now talk about new pbmtobraille tool I created.
You find the C source, a syntax highlighted version and sample outputs generated in pbmtobraille.zip for download.
pbmtobraille.c[.pre.html] is a small C program (97 lines without comments containing sample outputs) doing just what it says:
Converting a .pbm bitmap to Braille character output.
pbmtobraille.c.html is just the syntax highlighted version.
samples.txt[.pre.html] contains various sample output produced (shown below), which are part of pbmtobraille.c's comments too.
9x9.pbm is a really crazy parsing sample according the .pbm spec, following this statement:
"Mr. Poskanzer cautions that programs that read this format should be as
lenient as possible, accepting anything that looks remotely like a pixmap."
This is top of tail comment section, showing graphviz output done by pbmtobraille:
And finally this is bottom section showing a bigger layout in vertical direction (layout=TB is default, Top to Bottom):