143 points · by jacquesm · 8y ago · 98 comments
Actually, now that I think about it, the slide started all the way back in 2010 when I couldn't find a decent DjVu viewer for the iPad.
Just be careful that it doesn't silently change the text, because JBIG2 compressors can be lossy that way:
Also, I don't always scan myself. Sometimes I'll get a PDF generated by someone else, which contains scanned images. Then I'll often convert it to DJVU for speed and space savings.
One interesting trick I've tried, however, is to first remove all internal compression from PDF streams, and then apply LZMA to the resulting PDF. This can be a good way to compress PDFs losslessly.
And this out-compresses PDF's internal compression?
Could PDF be updated in future to support superior compression algorithms?
I presume it only works with NTFS? Surprised the page doesn't say.
Quite strange this scepticism here about good old djvu. Better fetch a book from the Internet Archive in both formats and check for yourselves why it's a thing.
50 years from now, you are not going to have any trouble finding a .PDF viewer, but DjVu is a different question entirely.
Frankly I don't expect having to read PDF files 50 years from now, but if I were thinking about preservation, the timeproof archiving medium still is acid-free paper –better yet, vellum– and probably India ink. As for the need of any technology, beyond stone tools and fire nobody really needs anything, it's just convenient.
That is a very bold statement. 50 years is a long time even in human years. It's an eternity in technology years.
But going out on a limb with a format doesn't instill confidence for long term. It's great there's one "perfect" implementation that seems to just work, but perceived lack of an ecosystem is still worrying. Not that looking through the source of say libjpeg instills confidence either! I was also considering JP2 for nicer-looking artifacts, but couldn't bring myself to go that route.
I eventually just increased my size budget (because disappearing a ream into 5GB is still damn useful!), and decided to just store lossless FLIF at 300dpi. I statically compiled the flif binary, do a test decode to make sure the bits round trip, and store checksums of the decoder binary and raw raster alongside.
I then stuff this into a zip container (aka .cbz), along with some really poor jpg thumbnails so present evince can view it. I still need to write the transcoder to .djvu - when I'm no longer buried under piles of paper!
Something a little more up to date and more focused on today's technologies would be really nice.
It’s a very specific and ( hopefully) narrow need and is the only reason i’m starting this project in the first place.
Do you have some concrete examples of corrupted texts? I'd very much like them to use as test cases in a document processing pipeline.
DjVU: https://ia800204.us.archive.org/28/items/cu31924026442156/cu...
PDF: https://ia800204.us.archive.org/28/items/cu31924026442156/cu...
I don't have an easy way to find all of the errors I observed but typical ones are on page 58 at the end of the third line, 'Germanic' with a little bit of bleed between the serifs at the bottom of 'n' gets transformed into 'Germauic', and on page 420 at the end of line 7, 'compass' with a small dot in the middle of the 'o' becomes 'cempass'.
FWIW I've transcribed a bunch of other DjVu files produced by the Internet Archive and not noticed anything like this.
If I can reliably flag problem cases then at least I will know which files are going to have a lot of manual work.
How would you know? Maybe if a document had an unusual misspelling. But how would you know if DjVu munged a 3 into an 8?
By comparing it with the original, surely.
Particularly because Xerox photocopiers (yes, self-contained photocopiers) had exactly the same kinds of issues due to image compression engine glitches (https://news.ycombinator.com/item?id=6156238, https://news.ycombinator.com/item?id=9584172)
JBIG2 was based upon JB2.
There aren't a lot of viewers out there for DjVu and the encoding side is patent encumbered, so I'm not interested in the format.
You can get pretty close with JBIG2+Jpeg2k in a PDF file, I believe archive.org does this, but I don't know of an open source encoder that does it and sometimes PDF viewers don't decode jbig2/jpg2k efficiently.
DJV View http://djv.sourceforge.net/
WinDjView https://windjview.sourceforge.io/
Other than that, DjVu is a great format.
For those who wonder how it's better than PDF for scanned texts - DjVu uses different compression for background and actual text, thus saving tons of space.
But worst case scenario you could run something like Pale Moon or WaterFox only for accessing such documents.
Also I know how slow institutional entities can be to adapt, but they will catch up eventually.
Okular(provided by KDE), for example, is blazingly fast. Or at least, I haven't noticed any slowness.
Also PDF is an open format.
Now that it is, there's probably no reason to use DjVu.