Florida2K – Read Punched Cards with a Scanner

In DataMuseum.DK we had a pile of punched cards with a COMAL interpreter and we wanted to try to run it.

We have Punched Card Readers, but they are temperamental beasts, so I thought it would be a good idea to be able to read punched cards by running the cards through a scanner and processing the images.

There are few things more educational than finding the answer to “How hard can that be…?” the hard way.

The result became a Python3 program which I named “Florida2K” and this is where I explain how it works, why it sometimes does not and what you can do about it.

This is a Punched Card scanned at 100 DPI in our Canon DR9080C scanner:

../../_images/card0.png

In difference from a real punched card reader, which uses the holes to shine light through, conduct electricity through or even poke mechanical “fingers” through, we only have a picture of the holes.

I want to put up a big warning sign at this point: Whatever scanner you use, however you use it, you need to make the holes come out dark on the images. Some scanners, like ours, do this already, others, notably fladbed scanners, do not. You will have to figure this out yourself.

How to scan the Punched Cards

The Florida2K program expects the scanned images to be in “portrait” format, like in the image above, that way you can use the automatic feeder on the scanner if you have one.

If your images are in a different orientation, you will have to rotate them before feeding them to Florida2K. ImageMagick’s convert program will do the job nicely.

The card MUST be centered horizontally in the image (XXX: Add arg to offset ?) so that the 12 rows are split in two groups of 6 by the vertical center line.

Set your scanner for 100 DPI and grayscale, this will work most of the time.

Note that punched cards are symmetric, not only up/down and left/right but also front/back.

If your scanner has an autofeeder and can scan both sides in one go, do so, and give Florida2K the option -2 for “duplex”. This makes the program process images in pairs of front+back and it will complain if the holes do not match.

If you can only scan one side of the cards automatically, and you do not plan to or need to save the images, scan the backside, which almost never has any printing on it, and give Florida2K the option -b for “back”.

If this does not work for you, read more about Florida2K – Scanner Setings.

References

FIPS 13 / ANSI X3.21-1967 Rectangular Holes in twelve-row punched cards

phk