by tasty_freeze · 7y ago · 0 comments
Currently I'm using a 10 year old paid version of Acrobat Pro because I'm unwilling to spend another $500 to get a modern copy simply to compress images. I use it for scanning and archiving old computer manuals. In many cases jbig on 1bpp images is good enough; other times I want to use one of the more sophisticated hybrid schemes so I can have B&W or color images interspersed on the page with 1bpp text. Acrobat does a pretty good job of auto-deskewing images and doing analysis to figure out which compression type to use in different sections of the same page.
ps2pdf LARGE.pdf SMALL.pdf
I believe it compresses all of the images independently, instead of converting the entire thing to an image as I believe Imagick does (I could be wrong though). This tool doesn't appear to have any intelligent auto-deskewing though. (On a slightly different note, it's questionable whether you want to do this for archiving as it'll undoubtedly be a lossy operation.)The reason I use this: Many websites for conferences have upload limits at around 10MB, a size you can easily reach with a handful of images from a modern device in your paper.
[1] https://www.shellhacks.com/linux-compress-pdf-reduce-pdf-siz...
ps2pdf does work on Windows though (or maybe it's pstopdf?), and the Linux version works directly in WSL.
As the PS format was designed for printing [2], my guess is that it selects a DPI value suitable for printing. I can't seem to find the source code to back this up though. (Ghostscript has the simple web front-end that doesn't lend itself very well for viewing code in browser [3].)
[1] https://www.biu.ac.il/os_site/documentation/gs/Ps2pdf.htm
https://github.com/4lex4/scantailor-advanced
I find the autodeskewing algorithm to work well, but it allows hand adjustment as well, which I like. As I've gotten better as using it, I've been able to get the size of my scanned documents down considerably by cleaning up the scans. This includes some old manuals.
As far as the pdf encoding itself, I use both mutool, from mupdf, and qpdf. I just checked and it looks like while they both compress their streams, it may not have the same flexibility with Acrobat Pro. For me, I'll decompress, edit, and recompress streams on the files and that's been fine for my use.
That said, if someone knows of a better tool for compressing streams in a PDF, I'd be interested to hear about it as well.
They have an enterprise PDF compression toolkit which clearly supports all the advanced compression schemes of PDF, but it is too rich for me: prices are not given, just a button to ask for a quote. There is a personal PDF tool for $129 but they don't make clear if it also supports their top quality PDF compression.