Help:Creating a DjVu file
From Wikimedia Commons, the free media repository
This page explains how to create a DjVu file. The format can be used in galleries or categories like any supported image format, and reduces the size and number of the files that need to be copied.
If you have difficulties, you can ask for help at the Commons:Help desk.
Example: [[Image:Alice in Wonderland.djvu|thumb|Alice in Wonderland, page 9|page=9]].
.
Contents |
[edit] Introduction
The aim is to create a DjVu file from bitmap versions (jpg, tif, etc.) found on Internet or scanned. This is favourable because:
- all pages of a book are available on a single file
- all pages can be seen from the file page of the DjVu file
- every page can be used in the "page" space
- DjVu files are small
- only one single file needs to be copied, compared to hundreds of pages in bitmap format.
- creating a DjVu file is quicker than uploading hundreds of bitmap files.
Drawbacks:
- The numbering of the pages does not seem to be freely configurable
- Loss of quality can occur
[edit] Creating a DjVu file
[edit] MS Windows
Install DjVu Solo. It is also possible to use LizardTech Virtual Printer, which is available for no charge and can convert documents through a printing process.
[edit] Conversion through DjVu Solo
Procedure is more or less the same for all conversion programmes: load the bitmap files into the programme, check their order and launch the conversion process.
[edit] Acquiring bitmap files
If you have a scanner, DjVu can use it to import bitmap files.
[edit] Page numbering
The DjVu format created a default page numbering which is displayed in a drop-down menu (see Image:Notes de voyages, II.djvu). It is advisable to have the page numbering match that of the original book, for easier use. This can be problematic when some pages (like in introductions) are numbered in Roman numbers. In this case, one solution is to create a second DjVu file for these pages.
[edit] Resolution
By default, DjVu Solo is set to convert pages with a 300 dpi resolution. This is usually a good value.
[edit] Converting a pdf file
Any2DjVu Server allows to directly convert a pdf file.
Pdf files from Gallica can be fetched simply by giving their FTP address to Any2DjVu Server. However, it is often advisable to edit the pdf file to have a better placement of the page in the frame. This can be done by extracting all pages and cropping them with software like XnView, and by loading them into DjVu Solo.
Google Books files cannot be converted directly because of their compression. Pages should be extracted and converted in a bitmap format in order to create the DjVu file. Several method have been tested:
- opening the file in FineReader
- utilising PdfCreator, which can export PDF is several bitmap formats.
- utilising pdf to jpg or tiff programme. These are often proprietary software.
[edit] Other formats
Tiff files from Gallica can be opened in FineReader (even after the evaluation period is over). By exporting the pages into tiff (same format), it is possible to crop the margins with XnView, and to load the pages into DjVu Solo. Page numbering is automatic.
[edit] On Linux
You need the djvu software, which includes a viewer, and some tools for creating and handling DJVU files. You will probably also need the Imagemagick software for converting scans from one format to another. The tool cjb2 is used to creating a DJVU file from a PBM or TIFF file. Therefore you need to convert your scans if there are not already in one of these formats.
- Conversion from PNG format to PBM format with the tool convert from Imagemagick
convert rig_veda-000.png rig_veda-000.pbm
- Depending on the quality of the original scans, you may find it useful to process them with the unpaper utility, which deletes black borders around the pages and aligns the scanned text squarely on the page. Unpaper is also capable of extracting two separate page images where facing pages of a book have been scanned into a single image.
- Creation of a DJVU file from a PBM file
cjb2 -clean rig_veda-000.pbm rig_veda-000.djvu
- Adding the DJVU file to the final document
djvm -i rig_veda.djvu rig_veda-000.djvu
You need to repeat these steps with a script for each page of the book. Example:
#!/bin/bash for n in `seq 1 9` do i="rig_veda-$n.png" j=`basename $i .png` convert $i $j.pbm cjb2 -clean $j.pbm $j.djvu djvm -i rig_veda.djvu $j.djvu done
[edit] DjVu format use in page mode
(This only works if you have the ProofreadPage extension installed, like some Wikisources such as English, German and French.)
Once a DjVu file is uploaded to Commons, an index page needs to be created. Navigation in the "page" space is done by using the name of the file prefixed by "page:" and followed by "/X", with "X" is the page number.
[edit] Resources
- browser plugin for viewing DjVu: works on IE, Firefox and Safari, for Windows, Mac OS X and *n*x
- DjVuLibre package for Mozilla, Firefox, Konqueror, Netscape, Galeon, and Opera, Unix.
- Any2DjVu

