Noticed a warning while using ocrmypdf, and investigated. Turns out ocrmypdf can work in tandem with jbig2enc to compress parts of the scanned pdf using the text info it gathered.
The results are fairly pleasant:I passed a full scanned book thru orcmypdf. Results: 12082012 bytes without jbig2enc 10059811 bytes with jbig2enc with no visible degradation, as far as I can see. Port is decently trivial, there's just a small patch, because meson might try to build giflib is not already there, and it auto-detects using a pkgconfig file we don't have, but I've checked: giflib is only brought in thru leptonica and there's zero mention of giflib artifacts anywhere in the code. Requires C++17, hence the COMPILER line, but I doubt it will be of much use on older architectures anyway. ocrmypdf picks it up automatically if it's installed, with no need to do anything. The PATENTS file is there just as a safeguard. Reading the Annex I of fcd14492.pdf, the most recent patent referenced was filed in 1997. So it expired a few years ago. Port is attached
jbig2enc-0.32.tgz
Description: application/tar-gz
