How to Scan Multipage Documents to DjVu in X
a report by PlanetDjVu, October 15, 2003


DjVuLibre can be used in X Window System to convert a single image files to DjVu, but how can you set up an environment to scan multiple pages directly into a DjVu document? We explain how.

You will need two additional open source tools:  xscanimage and SANE.

xscanimage provides a graphical user-interface to control an image acquisition device such as a flatbed scanner or a camera. It allows previewing and scanning invidual images and can be invoked either directly from the command-line or through The GIMP image manipulation program. In the former case,

xscanimage acts as a stand-alone program that saves acquired images in a suitable PNM format (PBM for black-and- white images, PGM for grayscale images, and PPM for color images). In the latter case, the images are directly passed to The GIMP for further processing.

xscanimage accesses image acquisition devices through the SANE (Scanner Access Now Easy) interface.

SANE is an application programming interface (API) that provides stan- dardized access to any raster image scanner hardware. The standardized interface makes it possible to write just one driver for each scanner device instead of one driver for each scanner and application.

While SANE is primarily targeted at a UNIX environment, the standard has been carefully designed to make it possible to implement the API on virtually any hardware or operating system.

All these tools taken together make it very easy to create djvu files of long scanned documents. (Sane can be set to rotate images, so you can scan the left and right pages of books at the same time.)

You will need an extra small script to to create djvu files from pnm files. Here it is:

for file in $( ls *.pnm); do
filename=${file%.pnm}
echo cjb2 $file $filename.djvu
cjb2 -dpi 600 $file $filename.djvu
rm $file
done














Hosted by uCoz