Update on using awk to do graphics
Sunday, 15 February 2026 08:30 pmWith enormous help from KimiAI, I have been working on producing a graphics server that acts as a graphics screen for programs and computer languages that can't do graphics themselves, like, for example, awk. I can write images, and even animations (though primitive so far) by using the text output from awk (or any computer langauage) to draw on a canvas.
Previously (back in November 2023) I wrote here about my attempts to give awk graphical output by writing directly to an ASCII .pbm file. It works, but is a bit clunky and inconvenient. At the time I compared the speed of various ways to draw a 256x192 pixel image of Wolfram's 1D cellular automaton (rule 30).
And just to show off the amazing capabilities of this graphics server, here is a Mandelbrot set drawn by a short awk program sending its text output to the canvas server. The 800x800 pixel image took just 10 seconds to calculate:
![awk mandelbrot set 800x800 [10 secs]](https://miriam-english.org/lj/awk_mandelbrot_set_800x800_[10_secs].png)
I have just a few more improvements to this graphics server and I'll upload it to my website for anybody to use.
Previously (back in November 2023) I wrote here about my attempts to give awk graphical output by writing directly to an ASCII .pbm file. It works, but is a bit clunky and inconvenient. At the time I compared the speed of various ways to draw a 256x192 pixel image of Wolfram's 1D cellular automaton (rule 30).
That's slower than awk writing to a .pbm image file, but much more satisfying, as I can watch the image being drawn. This lets me catch errors early or enjoy animation. And it is far quicker and simpler than python graphics... and python can write to the canvas through the server too. In fact any program with text output can, even the bash shell!
1 hr 8 minutes -- the old CoCo computer
5 minutes -- the CoCo emulator running as fast as my computer allowed
12 minutes -- using python
0.08 second -- awk creating a .pbm image file
and now...
0.633 second -- awk drawing onto a canvas through my graphics server.
And just to show off the amazing capabilities of this graphics server, here is a Mandelbrot set drawn by a short awk program sending its text output to the canvas server. The 800x800 pixel image took just 10 seconds to calculate:
![awk mandelbrot set 800x800 [10 secs]](https://miriam-english.org/lj/awk_mandelbrot_set_800x800_[10_secs].png)
I have just a few more improvements to this graphics server and I'll upload it to my website for anybody to use.
