What is djvu?

DjVu ( , like French "déjà vu"1) is a computer file format designed primarily to store scanned documents, especially those containing a combination of text, line drawings, indexed color images, and photographs. It uses technologies such as image layer separation of text and background/images, progressive loading, arithmetic coding, and lossy compression for bitonal (monochrome) images. This allows high-quality, readable images to be stored in a minimum of space, so that they can be made available on the web.

DjVu has been promoted as providing smaller files than PDF for most scanned documents.2 The DjVu developers report that color magazine pages compress to 40–70 kB, black-and-white technical papers compress to 15–40 kB, and ancient manuscripts compress to around 100 kB; a satisfactory JPEG image typically requires 500 kB.3 Like PDF, DjVu can contain an OCR text layer, making it easy to perform copy and paste and text search operations.

Free creators, manipulators, converters, Web browser plug-ins, and desktop viewers are available.4 DjVu is supported by a number of multi-format document viewers and e-book reader software on Linux (Okular, Evince, Zathura), Windows (Okular, SumatraPDF), and Android (Document Viewer,5 FBReader, EBookDroid, PocketBook).


The DjVu technology was originally developed by Yann LeCun, Léon Bottou, Patrick Haffner, Paul G. Howard, Patrice Simard, and Yoshua Bengio at AT&T Labs from 1996 to 2001.6

Prior to the standardization of PDF in 2008,78 DjVu had been considered superior due to it being an open file format in contrast to the proprietary nature of PDF at the time. The declared higher compression ratio (and thus smaller file size), and the claimed ease of converting large volumes of text into DjVu format, were other arguments for DjVu's superiority over PDF in the technology landscape of 2004. Independent technologist Brewster Kahle in a 2004 talk on IT Conversations discussed the benefits of allowing easier access to DjVu files.910

The DjVu library distributed as part of the open-source package DjVuLibre has become the reference implementation for the DjVu format. DjVuLibre has been maintained and updated by the original developers of DjVu since 2002.11

The DjVu file format specification has gone through a number of revisions, the most recent being from 2005.

<table> <caption>Revision history</caption> <thead> <tr class="header"> <th><p>Version</p></th> <th><p>Release date</p></th> <th><p>Notes</p></th> </tr> </thead> <tbody> <tr class="odd"> <td></td> <td><p>1996–1999</p></td> <td><p>Developmental versions by AT&amp;T labs preceding the sale of the format to <a href="LizardTech" title="wikilink">LizardTech</a>.</p></td> </tr> <tr class="even"> <td><p><a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a></p></td> <td><p>April 1999</p></td> <td><p>DjVu version 3. DjVu changed from a single-page format to a multipage format.</p></td> </tr> <tr class="odd"> <td><p><a href="#fn2" class="footnote-ref" id="fnref2" role="doc-noteref"><sup>2</sup></a></p></td> <td><p>September 1999</p></td> <td><p>Indirect storage format replaced. The searchable text layer was added.</p></td> </tr> <tr class="even"> <td><p><a href="#fn3" class="footnote-ref" id="fnref3" role="doc-noteref"><sup>3</sup></a></p></td> <td><p>April 2001</p></td> <td><p>Page orientation, color JB2</p></td> </tr> <tr class="odd"> <td><p><a href="#fn4" class="footnote-ref" id="fnref4" role="doc-noteref"><sup>4</sup></a></p></td> <td><p>July 2002</p></td> <td><p>CID chunk</p></td> </tr> <tr class="even"> <td><p><a href="#fn5" class="footnote-ref" id="fnref5" role="doc-noteref"><sup>5</sup></a></p></td> <td><p>February 2003</p></td> <td><p>LTAnno chunk</p></td> </tr> <tr class="odd"> <td><p><a href="#fn6" class="footnote-ref" id="fnref6" role="doc-noteref"><sup>6</sup></a></p></td> <td><p>May 2003</p></td> <td><p>NAVM chunk. Support for DjVu bookmarks (outlines) was added. Changes made by Versions 23 and 24 were made obsolete.</p></td> </tr> <tr class="even"> <td><p><a href="#fn7" class="footnote-ref" id="fnref7" role="doc-noteref"><sup>7</sup></a></p></td> <td><p>April 2005</p></td> <td><p>Text/line annotations</p></td> </tr> <tr class="odd"> <td><p><small></small></p></td> <td></td> <td></td> </tr> </tbody> </table> <section class="footnotes footnotes-end-of-document" role="doc-endnotes"> <hr /> <ol> <li id="fn1" role="doc-endnote"></li> <li id="fn2" role="doc-endnote"></li> <li id="fn3" role="doc-endnote"></li> <li id="fn4" role="doc-endnote"></li> <li id="fn5" role="doc-endnote"></li> <li id="fn6" role="doc-endnote"></li> <li id="fn7" role="doc-endnote"></li> </ol> </section>

Revision history

Role in the software ecosystem

The primary usage of the DjVu format has been the electronic distribution of documents with a quality comparable to that of printed documents. As that niche is also the primary usage for PDF, it was inevitable that the two formats would become competitors. It should however be observed that the two formats approach the problem of delivering high resolution documents in very different ways: PDF primarily encodes graphics and text as vectorised data, whereas DjVu primarily encodes them as pixmap images. This means PDF places the burden of rendering the document on the reader, whereas DjVu places that burden on the creator.

During a number of years, significantly overlapping with the period when DjVu was being developed, there were no PDF viewers for free operating systems — a particular stumbling block was the rendering of vectorised fonts, which are essential for combining small file size with high resolution in PDF. Since displaying DjVu was a simpler problem for which free software was available, there were suggestions that the free software movement should employ DjVu instead of PDF for distributing documentation; rendering for creating DjVu is in principle not much different from rendering for a device-specific printer driver, and DjVu can as a last resort be generated from scans of paper media. However when FreeType 2.0 in 2000 began provide rendering of all major vectorised font formats, that specific advantage of DjVu began to erode.

In the 2000s, with the growth of the World Wide Web and before widespread adoption of broadband, DjVu was often adopted by digital libraries as their format of choice, thanks to its integration with software like Greenstone12 and the Internet Archive,13 browser plugins which allowed advanced online browsing, smaller file size for comparable quality of book scans and other image-heavy documents14 and support for embedding and searching full text from OCR.1516 Some features such as the thumbnail previews were later integrated in the Internet Archive's BookReader17 and DjVu browsing was deprecated in its favour as around 2015 some major browsers stopped supporting NPAPI and DjVu plugins with them.18

DjVu.js Viewer attempts to replace the missing plugins.

Technical overview

File structure

The DjVu file format is based on the Interchange File Format and is composed of hierarchically organized chunks. The IFF structure is preceded by a 4-byte AT&T magic number. Following is a single FORM chunk with a secondary identifier of either DJVU or DJVM for a single-page or a multi-page document, respectively.

All the chunks can be contained in a single file in the case of the so called bundled documents, or can be contained in several files: one file for every page plus some files with shared chunks.

Chunk types

<table> <caption>Chunk types in DjVu files</caption> <thead> <tr class="header"> <th><p>Chunk identifier</p></th> <th><p>Contained by</p></th> <th><p>Description</p></th> </tr> </thead> <tbody> <tr class="odd"> <td><p>FORM:DJVU</p></td> <td><p>FORM:DJVM</p></td> <td><p>Describes a single page. Can either be at the root of a document and be a single-page document or referred to from a chunk.</p></td> </tr> <tr class="even"> <td><p>FORM:DJVM</p></td> <td></td> <td><p>Describes a multi-page document. Is the document's root chunk.</p></td> </tr> <tr class="odd"> <td><p>FORM:DJVI</p></td> <td><p>FORM:DJVM</p></td> <td><p>Contains data shared by multiple pages.</p></td> </tr> <tr class="even"> <td><p>FORM:THUM</p></td> <td><p>FORM:DJVM</p></td> <td><p>Contains thumbnails.</p></td> </tr> <tr class="odd"> <td><p>INFO</p></td> <td><p>FORM:DJVU</p></td> <td><p>Must be the first chunk. Describes the page width, height, format version, <a href="pixel_density" title="wikilink">resolution</a>, <a href="gamma_correction" title="wikilink">gamma</a>, and rotation.</p></td> </tr> <tr class="even"> <td><p>DIRM</p></td> <td><p>FORM:DJVM</p></td> <td><p>Must be the first chunk. References other chunks. These chunks can either follow this chunk inside the chunk or be contained in external files. These types of documents are referred to as <em>bundled</em> or <em>indirect</em>, respectively.</p></td> </tr> <tr class="odd"> <td><p>NAVM</p></td> <td><p>FORM:DJVM</p></td> <td><p>If present, must immediately follow the chunk. Contains a BZZ-compressed outline of the document.</p></td> </tr> <tr class="even"> <td><p>ANTa, ANTz</p></td> <td><p>FORM:DJVI or FORM:DJVU</p></td> <td><p>Annotations.</p></td> </tr> <tr class="odd"> <td><p>TXTa, TXTz</p></td> <td><p>FORM:DJVU</p></td> <td><p>Unicode text and layout information.</p></td> </tr> <tr class="even"> <td><p>INCL</p></td> <td><p>FORM:DJVU</p></td> <td><p>The ID of an included chunk.</p></td> </tr> <tr class="odd"> <td><p>Sjbz</p></td> <td><p>FORM:DJVU</p></td> <td><p>BZZ compressed JB2 bitonal data used to store mask.</p></td> </tr> <tr class="even"> <td><p>Djbz</p></td> <td><p>FORM:DJVI or FORM:DJVU</p></td> <td><p>Shared shape table.</p></td> </tr> <tr class="odd"> <td><p>WMRM</p></td> <td><p>?</p></td> <td><p>JB2 data required to remove a watermark.</p></td> </tr> <tr class="even"> <td><p><s>CIDa</s></p></td> <td><p>FORM:DJVU</p></td> <td><p>Obsolete chunk with unknown content.</p></td> </tr> </tbody> </table>

Chunk types in DjVu files


DjVu divides a single image into many different images, then compresses them separately. To create a DjVu file, the initial image is first separated into three images: a background image, a foreground image, and a mask image. The background and foreground images are typically lower-resolution color images (e.g., 100 dpi); the mask image is a high-resolution bilevel image (e.g., 300 dpi) and is typically where the text is stored. The background and foreground images are then compressed using a wavelet-based compression algorithm named IW44.19 The mask image is compressed using a method called JB2 (similar to JBIG2). The JB2 encoding method identifies nearly identical shapes on the page, such as multiple occurrences of a particular character in a given font, style, and size. It compresses the bitmap of each unique shape separately, and then encodes the locations where each shape appears on the page. Thus, instead of compressing a letter "e" in a given font multiple times, it compresses the letter "e" once (as a compressed bit image) and then records every place on the page it occurs.

Optionally, these shapes may be mapped to UTF-8 codes (either by hand or potentially by a text recognition system) and stored in the DjVu file. If this mapping exists, it is possible to select and copy text.

Since JB2 (also called DjVuBitonal) is a variation on JBIG2, working on the same principles,20 both compression methods have the same problems when performing lossy compression. In 2013 it emerged that Xerox photocopiers and scanners had been substituting digits for similar looking ones, for example replacing a 6 with an 8.21 A DjVu document has been spotted in the wild with character substitutions, such as an n with bleeding serifs turning into a u and an o with a spot inside turning into an e.22 Whether lossy compression has occurred is not stored in the file.23 Thus the DjView viewing application can't warn the user that glyph substitutions might have occurred, neither when opening a lossy compressed file, nor in the Information or Metadata dialogue boxes.24

Format licensing

DjVu is an open file format with patents.25 The file format specification is published, as well as source code for the reference library.26 The original authors distribute an open-source implementation named "DjVuLibre" under the GNU General Public License. The rights to the commercial development of the encoding software have been transferred to different companies over the years, including AT&T Corporation, LizardTech,27 Celartem28 and Cuminas.29

Celartem acquired LizardTech and Extensis.3031323334


The selection of downloadable DjVu viewers is wider on Linux distributions than it is on Windows or Mac OS. Additionally, the format is rarely supported by proprietary scanning software.

In 2002, the DjVu file format was chosen by the Internet Archive as a format in which its Million Book Project provides scanned public-domain books online (along with TIFF and PDF).35 In February 2016, the Internet Archive announced that DjVu would no longer be used for new uploads, among other reasons citing the format's declining use and the difficulty of maintaining their Java applet based viewer for the format.36

Wikimedia Commons, a media repository used by Wikipedia among others, conditionally permits PDF and DjVu media files.37

See also


External links

Original source: djvu. Shared with Creative Commons Attribution-ShareAlike 3.0 License


  1. Artem Mikheev, Luc Vincent, Mike Hawrylycz & Léon Bottou: Electronic Document Publishing Using DjVu

  2. See the JBIG2 article for more details and references.

  3. Wikimedia Commons. Project scope: PDF and DjVu.