#jbig — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #jbig, aggregated by home.social.
-
Not actually back yet, just wanted to toot this for fun... ;)
Raw (TGA/Targa format) 1200ppi US Letter scan: 381MiB
PNG version: 27MiB
After contrast enhancement: 2.3MiB
After reducing to 10 colors: 1.2MiB
After re-doing reduction, first converting to grayscale: 1001KiB
Reducing to 4 shades of gray (from original 256-shade image): 727KiB
Reducing to monochrome (no perceptible loss in quality): 556KiB
Conversion to PDF + OCR with aggressive JBIG2 compression: 264KiBOverall compression factor from original scan: 1480.6:1
Overall compression factor from uncompressed monochrome version of scan: 61.7:1
Overall lossless compression factor (uncompressed monochrome to PNG monochrome): 29.2:1
Lossless compression factor for full-color image: 14:1
Data compression is a heck of a thing. ;)
-
To your first point, you're absolutely right. Thresholding yeilds far more than an 8:1 compression because PNG is far more able to crunch bilevel graphics vs. grayscale.
To your second point, you're describing the #JBIG lossy compressor for scanned documents and monochrome images, and yeah, that's super cursed. I'd be surprised if that's what
ocrmypdfis doing, but it's possible?¯\_(ツ)_/¯ -
The fax compression algorithms are very limited, designed for a time where RAM was scarce. They basically compressed a couple rows of pixels at a time, nothing more, AFAIK.
There is #JBIG, which is a LOSSY 1-bit monochrome image compression algorithm. Yes, it is exactly as cursed as that sounds, there have been many cases where numbers and figures were changed by JBIG because a 6 looked like an 8. Horrifying. XD
I'm not totally sure what happened in this example, because I realized after I posted this that the
pdfimagesutility is converting whatever the PDF stored the images as into PNGs, not just extracting any embedded PNGs it finds.