Digipres/Fanfold listings
Scanning Fanfold listings
We have continuous fanfold listings in our collection, and we do not want to separate the pages in order to feed them through our document scanner, both for reasons of preservation and integrity, but also because it is surprisingly common that lines straddle the perforations.
The current workflow uses a "CZUR" scanner, which is just a fancy webcam with good lightning, some line lasers and a foot-pedal.
It also comes with software, and if that works for you, by all means use it.
It does not work for me, so I ended up creating my own software and workflow.
Here is the setup:
Yes, that is a messy corner of my private workshop.
I use a steel-ruler to align the listing with the camera:
The steel ruler is held down by a random heavy items.
Align the ruler to the scan-lines of the camera as precisely as you can / want to.
Center the page in the camera's field of view, to minimize optical distortions.
Experiment and adjust lightning.
Not shown on the picture, is that I hold the paper flat with both hands, aligning the perforation to a particular point on the steel-ruler, in my case the 15cm mark.
I have not been able to detect activation of the CZUR foot-pedal from software, so instead I removed the ball from an old computer-mouse and used that as foot-pedal.
Capture Software
I needed a small program which I can activate with the mouse-pedal button, and I wrote this little python3 program:
#!/usr/bin/env python3
import subprocess
import glob
import os
def doit(*args, **kwargs):
last = list(sorted(glob.glob("*.png")))[-1:]
if len(last) == 0:
lno = 0
else:
lno = int(last[0][1:5]) + 1
print("DOIT", args, kwargs, last, lno)
subprocess.run(
[
'fswebcam',
'--no-banner',
'-r',
'5104x3828',
'--greyscale',
'--rotate', '90',
'--crop', '3200x2400,300x1500',
'--png',
'--save', "_%04d.png" % lno
]
)
from tkinter import *
from tkinter import ttk
root = Tk()
frm = ttk.Frame(root, padding=10)
frm.grid()
a = ttk.Button(
frm,
text="Hello World!",
command=doit,
# font="Inconsolata 30",
).grid(column=0, row=0)
ttk.Button(frm, text="Quit", command=root.destroy).grid(column=1, row=0)
root.mainloop()
Which runs the fswebcam program every time I press the "Hello World!" button
The parameters to fswebcam sets the CZUR webcam to max resolution, and performs some preliminary image processing, before storing the image as a PNG file.
Next time I will probably skip the image-processing steps, and do it all in the postprocessing.
If you are ever in doubt, take another picture, it's easy to delete the extra PNG files later.
Post-processing
Once I had all the PNG files in hand, and had deleted the pictures of my hands and other extras, I ran this script to produce the final PDF file:
set -ex
rm -rf _out
mkdir _out
for i in *.png
do
magick \
$i \
-auto-threshold otsu \
-crop 3020x2250+100+100 \
-compress Group4 \
_out/$i.tif
done
tiffcp -x _out/*.tif /tmp/_.tif
tiff2pdf /tmp/_.tif > /tmp/_.pdf
Obviously, it takes a bit of fiddling to get the crop parameters just right.
Example output
Alternative software
I tried a software-package called "webcamoid" but it could not keep up with the data-stream from the camera, and it would take up to a minute for the next page to appear in the preview.
Future work and ideas
A preview window would be nice, but I can live without it. Some day I will write a small program which keeps displaying the newest file in a directory, since that will also be handy for our document scanning workflow.
For listings where the tractor-holes are still attached, one could use an old desktop printer to move the paper, but I suspect it would still be necessary to hold the paper flat manually.