Files
ocrmypdf/docs/jbig2.rst
T

63 lines
2.1 KiB
ReStructuredText
Raw Normal View History

2022-07-28 01:06:46 -07:00
.. SPDX-FileCopyrightText: 2022 James R. Barlow
..
.. SPDX-License-Identifier: CC-BY-SA-4.0
.. _jbig2:
2019-06-22 17:29:26 -07:00
============================
2018-08-09 21:14:50 -07:00
Installing the JBIG2 encoder
============================
2019-06-22 17:29:26 -07:00
Most Linux distributions do not include a JBIG2 encoder since JBIG2
encoding was patented for a long time. All known JBIG2 US patents have
expired as of 2017, but it is possible that unknown patents exist.
2019-06-22 17:29:26 -07:00
JBIG2 encoding is recommended for OCRmyPDF and is used to losslessly
2021-08-15 05:05:27 +02:00
create smaller PDFs. If JBIG2 encoding is not available, lower quality
2019-06-22 17:29:26 -07:00
encodings will be used.
2019-06-22 17:29:26 -07:00
JBIG2 decoding is not patented and is performed automatically by most
2021-08-15 05:05:27 +02:00
PDF viewers. It is widely supported and has been part of the PDF
2019-06-22 17:29:26 -07:00
specification since 2001.
2019-06-22 17:29:26 -07:00
On macOS, Homebrew packages jbig2enc and OCRmyPDF includes it by
default. The Docker image for OCRmyPDF also builds its own JBIG2 encoder
from source.
For all other Linux, you must build a JBIG2 encoder from source:
.. code-block:: bash
2019-06-22 17:29:26 -07:00
git clone https://github.com/agl/jbig2enc
cd jbig2enc
./autogen.sh
./configure && make
[sudo] make install
2018-10-04 01:31:53 -07:00
.. _jbig2-lossy:
2022-07-12 02:18:17 -07:00
Dependencies include libtoolize and libleptonica, which on Ubuntu systems
2022-04-05 00:25:28 -07:00
are packaged as libtool and libleptonica-dev.
2018-10-04 01:31:53 -07:00
Lossy mode JBIG2
2019-06-22 17:29:26 -07:00
================
OCRmyPDF provides lossy mode JBIG2 as an advanced feature. Users should
`review the technical concerns with JBIG2 in lossy
2021-08-15 05:05:27 +02:00
mode <https://en.wikipedia.org/wiki/JBIG2#Disadvantages>`__
2019-06-22 17:29:26 -07:00
and decide if this feature is acceptable for their use case.
JBIG2 lossy mode does achieve higher compression ratios than any other
monochrome (bitonal) compression technology; for large text documents
the savings are considerable. JBIG2 lossless still gives great
compression ratios and is a major improvement over the older CCITT G4
standard. As explained above, there is some risk of substitution errors.
To turn on JBIG2 lossy mode, add the argument ``--jbig2-lossy``.
``--optimize {1,2,3}`` are necessary for the argument to take effect
also required. Also, a JBIG2 encoder must be installed as described in
the previous section.
*Due to an oversight, ocrmypdf v7.0 and v7.1 used lossy mode by
default.*