D8K/DOT-MATRIX PRINT SIMULATOR
2015-08-26 – There is now a web version of this tool. Visit http://laemeur.com/dotmat-web to check it out.
"THE PERSONAL PRINTER BUILT LIKE A SHERMAN TANK PERFORMS LIKE A STRADIVARIUS”
That’s the tagline from an old advertisement for the Okidata μ84 (a close cousin to the μ92 that I had when I was a kid), and it’s apt, I’d say, for dot-matrix printers in general.
Okay… you may or may not agree with the Stradivarius comparison, but I think they are beautiful instruments, and they produce beautiful music, in the air and on the page.
In an effort to capture some of the latter effect, I wrote an uncomplicated Perl script to simulate the hardcopy of of a 9-pin printer. If you’re not shy about using the command-line, and you’ve got Perl installed, you can download it and try it out here:
- dotmat.pl (9kb).
# feed me an ASCII-encoded PBM file, like so: # # $ ./dotmat.pl INFILE.PBM # # I will barf back out a binary PGM file to STDOUT, so if you want # that in a file, do like this: # # $ ./dotmat.pl INFILE.PBM > OUTFILE.PGM #
The image atop this page (40% of output size) is the script’s output for the following input bitmap [this is actually output from an older version of the script]:
A few things to keep in mind when using the program:
- The script simulates the output of an early '80s 9-pin Epson printer. The print resolution on these was fixed at 72dpi vertical, and selectable between 60dpi (480-dot mode) and 120dpi (960-dot mode) horizontal. By default, the script runs in "480-dot" mode. This produces images with a pixel aspect ratio of 6:5 – that is, images will look stretched horizontally unless you prescale your input files to compensate.
- Alternatively, you can run the script in 960-dot mode
by changing the
$xppdvariable to "6". This gives a pixel aspect ratio of 3:5 – that is, images will look stretched vertically unless you prescale your input files to compensate.
- Output files are high-res (~720dpi). So, don’t feed this thing a file that’s already huge. An input image of 480x720 pixels will be a full page (8'×10') in 480-dot mode; 960x720 will be a full page in 960-dot mode.
- The script is slow. Don’t worry, it’ll get the job done, but you may have to give it a few minutes, depending on the size of your input file. It takes almost a full minute to run the script on a 960×720px input image on my five-year-old laptop (Athlon P350 – 2 cores @2.2GHz). It's a lot faster than actually printing, though!
At present, this script handles the very simple task of transforming a bitmap image to a high-res simulated print. Printing graphics isn't exactly what impact printers were designed for, and certainly not what they're most commonly used for. Having a print simulator that could generate output from a text file would be useful. I'd like to extend the script to do that at some point.
Handling dot-matrix printer fonts is not quite as straightforward as "printing" an array of dots, however. Some research and sample font acquisition is needed before proceeding.
That is all! If you use the script in an interesting way, I’d love to hear about it.