Software Walkthrough, (strider1551's method)

This tutorial will show you my method for going from raw photos to a single DjVu file. This file will be very thorough, including metadata, bookmarks, positional OCR, and named pages. In general I take my time, double check for errors, etc.; making the file only happens once, but the file itself will exist for as long as you keep it.

I use Linux, and this tutorial is written with the assumption of being in that environment.

Organizing Files

With the amount of temporary data involved, my preference is to work from a secondary hard drive that I use a sandbox of sorts. This saves some wear-and-tear on my primary drive and avoids I/O bottlenecks if I have other applications running. It's completely unnecessary and overkill, but I like my setup.

Original Images

At the moment I only have one camera, so I capture all the right pages and then all the left pages. Before each series I also take an establishing shot with a ruler on the page, so that later I can measure the exact DPI. My camera names the images sequentially, so for a medium size book that I can do in one session, I would have a reference image, left pages, another reference image, and right pages. The front and back covers I normally just get with a flatbed scanner.

Once the camera is connected to a computer, I make sure that I didn't skip a page by checking that I have the same number of left and right images. The ruler is visible in my file browser's thumbnail (Thunar), so I click on the first reference image, shift-click on the last left image, note how many files are selected, and then repeat for the right images.

After that I use an image viewer (Eye of Gnome) to take a quick visual check of each image, mainly to make sure that the text is in focus. If everything checks out and no page needs to be reshot, I feel comfortable enough to put away the bookscanner.

Directory Structure

The directory I work from has the following sub-directories: covers, raw_left, raw_right, reference, replacements, tmp, work. Copies of the original images go in 'covers', 'raw_left', and 'raw_right'. The reference images that include the ruler go in 'reference'. Anything that had to be reshot, whether now or later, goes in 'replacements'. Obviously, 'tmp' is used for temporary things, and 'work' is for anything being enhanced by scantailor.

Renaming, Setting DPI

My naming convention is 'page_0000, page_0001, … page_n'. To rename the images that are separated into left/right, I use a simple python script that asks for the first number and then renames every file, incrementing the number by two each time. ''(I intend to add that script here later.)''

I also like to set the correct dpi on each image at this point by using mogrify (in another simple script). Most would probably prefer to correct the dpi in scantailor. In either case, finding the dpi is as simple as opening the reference image in Gimp and using the measure tool to count the pixels between two of the inch marks on the ruler.

Enhancing the Images (scantailor)

At this point I make a copy of all the images in the 'work' directory. Enhancing the images with Scan Tailor is a simple process that doesn't need much explanation. Very few of my books are anything other than text, so I normally set the output to black and white. I always set the output resolution to 600 dpi, regardless of what the input resolution was, because upscaling helps to preserve some detail that is lost when going from greyscale to black/white . Scantailor makes very few mistakes when working with decent images. Still, I do one step at a time, saving before each step and making a quick check of the thumbnail images after each step.

Setting Proper Margins

The most labor intensive part of Scantailor is setting the right margins, if you prefer to keep the same marginal space of the original book. Each book is unique, but look for part of the text that is always the same distance from the edge of the page - normally a header or footer works well. Measure the margin, and then set all images to be anchored to that side with the distance you measured. Then manually adjust non-standard pages, often things like a title page or the first page of a chapter. Finally, reset the ordering to "by tallest" and "by widest" to catch any pages that you may have missed.

Collecting Metadata

In my opinion, assuming you capture quality images, adding metadata to the DjVu file is what separates a decent file from a professional file. Adding metadata is easiest by creating files in the format used by djvused. Once you've created the DjVu file you can use djvused to add this information, or in this tutorial we will let djvubind add it automatically. I keep these files in the same directory as the final images, so that everything going into the DjVu file is in one staging area.

Creating a 'metadata' File

The metadata file contains information about the ebook itself, data such as author name, title, year of publication, etc. The format is very simple; each line should have the tag, one or more spaces, and the value enclosed in quotes.

author      "John Smith"
title       "A Clever Title"
subtitle    "With a Catchy Subtitle"
publisher   "Some Publishing Company"
address     "New York"
year        "1910"

Creating a 'bookmarks' File

The bookmark file us used to create a table of contents for quick navigation to a particular section of the book. The format is a little more complex, because it allows for a hierarchy. Here's an example to work from, and note that the page number is preceded by a pound sign.

 ("Cover" "#1" )
 ("Table of Contents" "#9" )
 ("Introduction" "#15" )
 ("Prologue" "#25" )
 ("Chapter 1" "#45" )
 ("Chapter 2" "#54" )
 ("Chapter 3" "#71" )
 ("Chapter 4" "#79" )
 ("Conclusion" "#90" )
 ("Notes" "#112" )
 ("Select Bibliography" "#115" )

Creating the DjVu File (djvubind)

Finally, I use djvubind to pull together all the images, metadata, OCR, etc. (I created djvubind, so I'm probably biased).

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License