Thursday, December 18, 2008

Creating DJVU files

I wanted to create a DJVU file from some photocopies (TIFF)

I found some nice tutorials at

Two incredible tools:

My final code was
To rotate and crop all the tiff files:
$ mogrify -rotate 90 *.tiff
mogrify -crop 3600x2448+600x0 *.tiff

And then the following script:


shopt -s extglob


for i in $MASK; do
if [ ! -e $i.djvu ]; then
echo "$i"
tifftopnm $i > $i.ppm
# unpaper --layout double --output-pages 1 $i.ppm x_$i.ppm
cpaldjvu -verbose -bgwhite -colors 2 $i.ppm $i.djvu
# rm x.ppm $i.ppm

# compile a bundled DjVu document
djvm -c book.djvu $MASK.djvu

To make the OCR, use the service in the page