preparing a document for a FAX service (e.g. j2)
Posted: 2018-02-10T06:21:59-07:00
Fax services like j2 can accept documents in any format regardless of how high the quality is, and it gets converted to fax quality before sending. The problem is that the sender has no idea what documents look like on the receiving end. The sender should convert the doc to fax quality so they can see what the recipient will see, and also for infosec reasons (if faxing a driver's license, passport, or signature, we don't need the fax service to have a high-quality version).
The fax service says it will accept "binary group 3 fax" and "TIFF CCITT group 3 & 4" (among many others). Group 4 fax is apparently for ISDN lines, and Group 3 is for POTS lines. Since most ppl have POTS, I'm thinking group 3 is what I should target. It's confusing to even know what file to produce, because there are these -compress options:
Is "GROUP4" a synonym for "G4"? Is the "GROUP4" format also a synonym for -compress Group4 outputfile.tiff?
I need to produce something that is multiple pages and as close to best fax-conforming quality as possible. Ideally all the conversion loss happens on my end, so the fax service doesn't have much affect on the quality - ultimately to know what will arrive. This is my (broken) approach:
That apparently failed because instead of producing a CCITT Group3 TIFF (which is what I think I need), it produced a raw group3 binary w/TIFF file extension (and apparently a group3 tiff differs from a group3 raw). I'm not sure how to get a "CCITT Group3 TIFF", so I tried to just see if I could work with the group3 raw:
The result was blurry and extremely low res:
When I zoom in the text is not legible. The source doc was a letter-sized page, and it got squashed vertically.
(edit)
I've found there exists a "TIFF-F (Class F)", which is a TIFF format that was designed specifically for fax. There is no class F TIFF in the output of convert -list format. So it seems ImageMagick is useful for despecking, bi-leveling, and changing the resolution, and then to finalize it into a class-F TIFF I'll need fax2tiff (part of the libtiff-tools pkg).
The fax service says it will accept "binary group 3 fax" and "TIFF CCITT group 3 & 4" (among many others). Group 4 fax is apparently for ISDN lines, and Group 3 is for POTS lines. Since most ppl have POTS, I'm thinking group 3 is what I should target. It's confusing to even know what file to produce, because there are these -compress options:
- Fax (is this group 3 compression?)
- Group4
- FAX (group 3 FAX)
- G3 (group 3 FAX)
- G4 (group 4 FAX)
- GROUP4 (TIFF Raw CCITT Group4)
- PDF (works with Fax/Group4 compression)
- TIFF
Is "GROUP4" a synonym for "G4"? Is the "GROUP4" format also a synonym for -compress Group4 outputfile.tiff?
I need to produce something that is multiple pages and as close to best fax-conforming quality as possible. Ideally all the conversion loss happens on my end, so the fax service doesn't have much affect on the quality - ultimately to know what will arrive. This is my (broken) approach:
Code: Select all
$ pdf2djvu -o vector.djvu vector.pdf
$ ddjvu -format=pdf -quality=80 vector.djvu raster.pdf
$ convert raster.pdf -colorspace gray +dither -colors 2 -normalize -monochrome -threshold 70% -despeckle -resample 25x38 -units PixelsPerInch -compress Fax G3:fax.tiff
$ display fax.tiff
display-im6.q16: Not a TIFF or MDI file, bad magic number 65535 (0xffff). `fax.tiff' @ error/tiff.c/TIFFErrors/564.
Code: Select all
$ convert raster.pdf -colorspace gray +dither -colors 2 -normalize -monochrome -threshold 70% -despeckle -resample 25x38 -units PixelsPerInch -compress Fax fax.g3
$ display fax.g3
Code: Select all
Image: fax.g3
Format: G3 (Group 3 FAX)
Class: PseudoClass
Geometry: 2592x418+0+0
Resolution: 204x196
Print size: 12.7059x2.13265
Units: PixelsPerInch
Type: Bilevel
(edit)
I've found there exists a "TIFF-F (Class F)", which is a TIFF format that was designed specifically for fax. There is no class F TIFF in the output of convert -list format. So it seems ImageMagick is useful for despecking, bi-leveling, and changing the resolution, and then to finalize it into a class-F TIFF I'll need fax2tiff (part of the libtiff-tools pkg).