Handbook:Advanced Server Configuration:JPEG and JBIG Faxing

The usage of JPEG and JBIG compression schemes are generally considered "advanced" fax features and may not be available to all fax machines. JPEG compression is most commonly used for sending and receiving color facsimile. JBIG compression is most commonly used for sending and receiving monochrome facsimile, but with a tighter compression (and thus faster send-times) than MMR. Both JPEG and JBIG facsimile compression require the usage of error-correction protocol (ECM).

JPEG
Currently JPEG support is only available in Class 1/1.0 receiving. JPEG send support is not yet available. The Class 2.1 specification does provide for JPEG support, but HylaFAX is not yet capable of sending or receiving JPEG facsimile in Class 2.1.

HylaFAX JPEG receive support is entirely dependent upon CIELAB JPEG support being available in libtiff, and libtiff gets some of its CIELAB JPEG support from libjpeg. Unfortunately, as of libjpeg version 6b released by the Independent JPEG Group (http://www.ijg.org/) libjpeg does not support CIELAB JPEG. This will require libjpeg to be patched, rebuilt, and reinstalled. The patch to libjpeg can be found here:

http://bugs.hylafax.org/bugzilla/show_bug.cgi?id=224#c7

Then libtiff will need to be patched, rebuilt, and reinstalled. The libtiff patch can be found here:

http://bugzilla.remotesensing.org/show_bug.cgi?id=736

At this point, then, color fax reception support can be enabled in the modem config file by setting:

Class1ColorJPEGSupport: yes

Most TIFF viewers will not be capable of displaying the JPEG-compressed TIFF pages with the proper color scheme (they would need to support CIELAB JPEG, which is mostly specific to fax). So to view JPEG-compressed TIFF images, convert them first using tiff2ps and then ps2pdf (or the bin/tiff2pdf HylaFAX script, as libtiff's tiff2pdf doesn't seem to work the same right now), or convert them to another color-supporting TIFF compression.

JBIG
HylaFAX supports both sending and receiving JBIG-compressed facsimile in Class 1/1.0. The Class 2.1 specification does not include JBIG, and so JBIG is not likely to be available with Class 2/2.0/2.1.

Like JPEG, HylaFAX JBIG receive support is entirely dependent upon JBIG support being available in libtiff. Most recent libtiff releases include the ability to write JBIG-compressed TIFF files. However, doing anything with the TIFF file from there will be difficult as TIFF viewers usually do not support JBIG compression. So usually the JBIG-compressed TIFF file requires conversion to PDF or a non-JBIG compression for viewing. This will require the installation of the JBIG-KIT library and libtiff to be patched, rebuilt, and reinstalled. The patch can be found here:

http://bugzilla.remotesensing.org/show_bug.cgi?id=896

At this point, then, JBIG fax reception support can be enabled in the modem config file by setting:

Class1JBIGSupport: yes

HylaFAX JBIG send support utilizes the ModemSoftRTFCC feature. Thus sending JBIG-compressed facsimile requires that ModemSoftRTFCC be enabled (which is the default setting). If the JBIG-KIT libraries were found when HylaFAX was compiled then the ModemSoftRTFCC feature will also convert to JBIG when appropriate (and Class1JBIGSupport will also default to "yes"). JBIG send support does not require libtiff to be patched.

A few words of caution about installing patched versions of libjpeg and libtiff:
 * On most systems several other packages will likely have been built against libjpeg and perhaps to a lesser extent also libtiff. Problems may likely arise with those other packages due to the library (libjpeg and/or libtiff) being altered without rebuilding that package. In this case these packages that also depend upon the library will also need to be rebuilt.
 * Some popular linux distributions include JBIG-KIT (presumably for the benefit of ImageMagick), but haven't yet included the JBIG patch to libtiff. HylaFAX releases as recent as 4.2.5 will enable Class1JBIGSupport on these distributions. In such cases, HylaFAX will receive faxes in JBIG format but libtiff will be incapable of handling them properly. Work is underway to automatically detect and work around this problem at http://bugs.hylafax.org/bugzilla/show_bug.cgi?id=730 but in the meantime, if you find you are receiving JBIG encoded tiffs that cannot be opened, try setting "Class1JBIGSupport: no" in your server configuration file.

The libtiff JBIG patch was paid-for work. Thanks in part goes to iFAX Solutions for the funding of that work.