5

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.

3 Answers3

10

Assuming you are on Linux. Install the djvulibre packages (on Debian/Ubuntu, it's apt install 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

Sources:

On Windows you could follow these steps on cygwin, WSL or similar.

balkian
  • 1,044
3

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
gavenkoa
  • 2,154
0

If you want to use multiple cores while conversion, so it will be much much ... much faster :

$ CPU_N="6"; DPI="100"; for i in `ls *.JPG`  ; do echo "$i --> ${i%.JPG}.djvu" ; c44  -dpi "$DPI"   $i   ${i%.JPG}.djvu &  { while [[  $( ps aux | grep c44 | grep -v grep | wc -l )  -eq "$CPU_N" ]] ; do  sleep 1 ; done ; };      done;   { while [[  $( ps aux | grep c44 | grep -v grep | wc -l )  -ge 1 ]] ; do  echo "wait.."; sleep 1 ; done ; }; echo "done" 

CPU_N = a number of cores you want to use for conversion.
DPI = set dpi for djvu files.

Actually -dpi setting of c44 command doesnt do anything usefull, however it is another story.

Alex
  • 150