I was advised on Stack Overflow to post here.
TL;DR: Can ImageMagick's convert
convert smartphone photographs of document pages to a fax-quality PDF file and shrink the file size by several orders of magnitude?
The details
I have lost count of the number of times I've experimented over the years to "convert" photographs of document pages to a fax-quality PDF. The photographs can take several MB's per page, while fax-quality can take a few dozen KB's at most. This is inconsequential on a per-page basis, but with everything being stored electronically, it adds up quick.
I've tried various combinations of convert
's named arguments -density 200x200
, -density 72x72
, -monochrome
, -colorspace Gray
, and -depth 2
. For example, one invocation pattern might be:
convert -density 72x72 -monochrome -depth 2 File1.jpg File2.jpg Output.pdf
I follow the conversion with pdfimages -list OutputFile.pdf
to inspect the result. In the past, this revealed that it always uses 8-bit depth regardless of the presence/absence/specification of the -depth
parameter. When -depth
is less than 8, however, not all gray levels are used, which allows the space to be recovered in the compression (which always seems to occur).
At no time, however, is the size of the output file less than the sum of the sizes of the input files. In fact, -monochrome
seems to double the file size, regardless of other parameters. So far, it seems that not specifying any optional parameters almost always gives the smallest file size, which still incurs extra tens of KB's. So there's no point doing any conversion. In fact, it's much more efficient to use pdfjam
to combine the photographed pages into a full-color full-resolution PDF.
My area of profession isn't image processing, but I done grad school in Elec. Eng. and have been exposed to concepts of sub-sampling, high/low frequency filtering, and anti-aliasing. It seems to me like it shouldn't be difficult to extract fax-quality from a photo, and get the reduced file size of fax-quality.
Is anyone aware of a convert
invocation pattern that will accomplish this? Is there a fundamental aspect of its operation that makes unachievable?