PDFBeads is a small utility written in Ruby which takes scanned
page images and converts them into a single PDF file. Unlike other
PDF creation tools, PDFBeads attempts to implement the approach
typically used for DjVu books. Its key feature is separating scanned
text (typically black, but indexed images with a small number of
colors are also accepted) from halftone pictures. Each type of
graphical data is encoded into its own layer with a specific
compression method and resolution.