convert serveral image files to a single djvu file

5,907

Solution 1

Assuming you are on Linux. Install the djvulibre packages (in Debian/Ubuntu djvulibre-bin), cd to the path where you have your images and run the following:

for x in *.jpg; do c44 -dpi 300 $x; done
djvm -c ../result.djvu *.djvu
ddjvu -format=pdf myfile.djvu myfile.pdf

Source: http://www.vitki.net/book/page/converting-jpeg-scans-or-djvu-files-pdf Another useful source: http://commons.wikimedia.org/wiki/Help:Creating_a_DjVu_file

On Windows you can either use cygwin and follow these steps or use any of the several available GUI tools. The latter option won't give you the same speed though, as it can't be scripted.

Solution 2

For color pages:

pages=pg1.djvu
c44 -dpi 300 pg1.jpg pg1.djvu

For black/white:

for (( i = 2; i <= $N; i++ )); do
  echo $i
  convert pg$i.jpg pg$i.pbm
  cjb2 pg$i.pbm pg$i.djvu
  pages="$pages pg$i.djvu"
done

Join all pages:

djvm -c book.djvu  $pages
Share:
5,907

Related videos on Youtube

user565739
Author by

user565739

Updated on September 18, 2022

Comments

  • user565739
    user565739 over 1 year

    Suppose I have serveral BMP image file, say 001.bmp, 002.bmp,..., 100.bmp. I want to convert these files to a single djvu file, whose first page is the content of 001.bmp, the second page is the content of 002.bmp...etc.

    What is the best way (software) to do this task? I don't want to upload those image file to a server, since it takes too much time. On the other hand, I am not restricted to use BMP files, I can also work with PNG or JPG files.

  • Diagon
    Diagon about 7 years
    Since c44 takes jpg's why do you suggest doing the conversion to pbm specifically for black and white?
  • mdcoder85
    mdcoder85 about 7 years
    BW uses a much less memory then color. cjb2 works only with pbm files if I proper remember...
  • Ruslan
    Ruslan over 5 years
    Note: you may want to add -percent 100 or similar option after -dpi 300, otherwise image quality in the resulting DJVU (and thus PDF) file may be quite bad.