Introduction
DjVu (said “déjà vu”) is a format for scanned documents, developed at AT&T Labs from 1996. It splits each scanned page into layers: a sharp black-and-white mask for the text and line art, and a low-resolution background and foreground for colour and pictures. Each layer is compressed with a method suited to it, so a scanned page is often much smaller than the same page as a JPEG or a PDF of images.
It is used mostly for scanned books and papers in online libraries and archives.
The extension is .djvu or .djv.
Structure
A DjVu file uses the IFF chunk layout, big-endian. It starts with the four bytes
AT&T, then a FORM chunk whose type is DJVU
for a single page or DJVM for a multi-page document. A page holds an
INFO chunk with its size and resolution, an Sjbz chunk with
the text mask compressed by JB2, BG44 and FG44 chunks with the
wavelet-compressed background and foreground, and optionally hidden text from OCR in a
TXTz chunk. A multi-page file starts with a DIRM directory of
its pages.
0AT&T magic bytes4 bytes4FORM chunk ID, length, form typeDJVU12 bytes16INFO width, height, version, resolutionvaries…Sjbz text and line art maskvaries…BG44, FG44 background and foreground colourvaries…TXTz hidden text, optionalvaries
Links
Software
- DjVuLibre and its DjView viewer (Windows, macOS, Linux)
- SumatraPDF (Windows)
- Okular (Linux, Windows)
Developers
- DjVuLibre, C++ library and command line tools that decode and encode DjVu