In my opinion the relative inaccessibility of DjVu's libdjvu
, including having their own bytestream compression contributed to the low acceptance of the DjVu format over the years and not patent issues. This hinders other software developers adapting their software to support DjVu and even more so
when porting to a new platform.
The DjVuLibre software has several characteristics that make it difficult to port. It is C++ based code that builds on a framework that seems to be generically usable, but is probably DjVuLibre specific. I conclude that on not having encountered the framework anywhere else, as well as specific names of classes, etc. that include the substring DJVU
) in the framework. That framework, in the form of libdjvu
, is however used in all of the DjVuLibre tools (bzz
. djvu...
)
The libdjvu
being a C++ library makes it less portable and less accessible for being called from other languages (e.g. Python), than a C based library.
To complicate things, the bytestreams in the DjVu file format are compressed using a Burrows Wheeler encoder. The encoder is similar to bzip2
but has its own, DjVu specific, implementation. This gives a small advantage over more standard compression schemes, but this is dwarfed by the conceptual better handling of compression of the images through the use of wavelet encoding and individually compressed layers.
I analysed the DjVuLibre software some time ago, to extract OCR-ed text. I settled for a minimal Python implementation for that piece, as I could not get a Python program to hook up to the C++ libraries in a reasonable amount of time. I spent a few days getting the Python implementation to work, analysing the intransparent program flow of the library, all the while comparing the output with results from djvutxt
and bzz
. This resulted in the DJVU OCR extraction program included in Calibre. (The difficulties might be based on
my lack of programming experience: I have been programming C++ since the late 80's—one of the first commercial things I developed in C++ was a library for creating GIF files in 1987—and have used Python since the mid 90's).
I must say I really like the DjVu concepts, and love the superior quality/filesize ratio, compared to scans in other file formats I have used. I always scan to .DjVu. But although I primarily work on a Linux system, the scanning/conversion process includes commercial software running on a Windows box that gives me even better compression results than the open DjVuLibre library does (as well as OCR without an additional program).