Re:LibGen's Bloat Problem
by crazygringo on Sunday August 21, 2022 @06:22PM
(#32545082)
Yeah, I always convert DVJU to PDF (pretty easy) but it never compresses quite as nicely.
DJVU is pretty clever in how it uses a mask layer for more efficient compression, and as far as I know, converting to PDF is always done "dumb" -- flattening the DJVU file into a single image and then encoding that image traditionally in PDF.
I wonder if it's possible to create a "lossless" DJVU to PDF converter, or something close to it, if the PDF primitives allow it? I'm not sure if they do, if the "mask layer" can be efficiently reproduced in PDF.
It can be done with relative ease. There is a commercial tool somewhere that does it, because I've run across many PDF files that use a DjVu like structure for scanned books.
It won't be perfectly lossless, because the IW44 compression of the color layer will need to be recompressed as JPEG or JPEG2000. The JB2 mask layer can be losslessly recompressed as JBIG2 or CCITT G4 Fax.
If you smoke enough algebra, you could use the DJVU algorithm to implement DJVU in PDF with layers. Or heck you could do it in SVG.
You can't do this in either PDF or SVG, except using JS, which many PDF and SVG viewers don't support.
Re:LibGen's Bloat Problem
by RicoElectrico on Sunday August 21, 2022 @07:42PM
(#32545647)
I think more often than not djvu blurs out half-tone which can be too aggressive for e.g. newspaper scans and makes a blurry mess.
This would be disastrous for preservation. Often the djvu versions have no digital version, the books not in print and the publisher isn't around. The djvu archives are often specifically because some old book, really has and had value to people.