<s>
JBIG2	B-Algorithm
is	O
an	O
image	B-General_Concept
compression	I-General_Concept
standard	O
for	O
bi-level	B-Algorithm
images	I-Algorithm
,	O
developed	O
by	O
the	O
Joint	O
Bi-level	B-Algorithm
Image	I-Algorithm
Experts	O
Group	O
.	O
</s>
<s>
It	O
is	O
suitable	O
for	O
both	O
lossless	B-Algorithm
and	O
lossy	B-Algorithm
compression	I-Algorithm
.	O
</s>
<s>
According	O
to	O
a	O
press	O
release	O
from	O
the	O
Group	O
,	O
in	O
its	O
lossless	B-Algorithm
mode	O
JBIG2	B-Algorithm
typically	O
generates	O
files	O
3	O
–	O
5	O
times	O
smaller	O
than	O
Fax	O
Group	O
4	O
and	O
2	O
–	O
4	O
times	O
smaller	O
than	O
JBIG	B-Application
,	O
the	O
previous	O
bi-level	O
compression	O
standard	O
released	O
by	O
the	O
Group	O
.	O
</s>
<s>
JBIG2	B-Algorithm
was	O
published	O
in	O
2000	O
as	O
the	O
international	O
standard	O
ITU	O
T.88	O
,	O
and	O
in	O
2001	O
as	O
ISO/IEC	O
14492	O
.	O
</s>
<s>
Ideally	O
,	O
a	O
JBIG2	B-Algorithm
encoder	O
will	O
segment	O
the	O
input	O
page	O
into	O
regions	O
of	O
text	O
,	O
regions	O
of	O
halftone	O
images	O
,	O
and	O
regions	O
of	O
other	O
data	O
.	O
</s>
<s>
Regions	O
that	O
are	O
neither	O
text	O
nor	O
halftones	O
are	O
typically	O
compressed	O
using	O
a	O
context-dependent	O
arithmetic	B-Algorithm
coding	I-Algorithm
algorithm	O
called	O
the	O
MQ	O
coder	O
.	O
</s>
<s>
A	O
dictionary	O
of	O
symbols	O
is	O
then	O
created	O
and	O
encoded	O
,	O
typically	O
also	O
using	O
context-dependent	O
arithmetic	B-Algorithm
coding	I-Algorithm
,	O
and	O
the	O
regions	O
are	O
encoded	O
by	O
describing	O
which	O
symbols	O
appear	O
where	O
.	O
</s>
<s>
For	O
lossy	B-Algorithm
compression	I-Algorithm
the	O
difference	O
between	O
similar	O
symbols	O
(	O
e.g.	O
,	O
slightly	O
different	O
impressions	O
of	O
the	O
same	O
letter	O
)	O
can	O
be	O
neglected	O
;	O
for	O
lossless	B-Algorithm
compression	I-Algorithm
,	O
this	O
difference	O
is	O
taken	O
into	O
account	O
by	O
compressing	O
one	O
similar	O
symbol	O
using	O
another	O
as	O
a	O
template	O
.	O
</s>
<s>
Overall	O
,	O
the	O
algorithm	O
used	O
by	O
JBIG2	B-Algorithm
to	O
compress	O
text	O
is	O
very	O
similar	O
to	O
the	O
JB2	O
compression	O
scheme	O
used	O
in	O
the	O
DjVu	O
file	O
format	O
for	O
coding	O
binary	B-Algorithm
images	I-Algorithm
.	O
</s>
<s>
PDF	B-Application
files	I-Application
versions	O
1.4	O
and	O
above	O
may	O
contain	O
JBIG2-compressed	O
data	O
.	O
</s>
<s>
Open-source	B-Application
decoders	O
for	O
JBIG2	B-Algorithm
are	O
jbig2dec	O
(	O
AGPL	B-Application
)	O
,	O
the	O
java-based	O
jbig2-imageio	O
(	O
Apache-2	B-Application
)	O
,	O
and	O
the	O
decoder	O
by	O
Glyph	O
&	O
Cog	O
LLC	O
found	O
in	O
Xpdf	B-Protocol
and	O
Poppler(both GPL )	O
.	O
</s>
<s>
An	O
open-source	B-Application
encoder	O
is	O
jbig2enc	O
(	O
Apache-2	B-Application
)	O
.	O
</s>
<s>
Typically	O
,	O
a	O
bi-level	B-Algorithm
image	I-Algorithm
consists	O
mainly	O
of	O
a	O
large	O
amount	O
of	O
textual	O
and	O
halftone	O
data	O
,	O
in	O
which	O
the	O
same	O
shapes	O
appear	O
repeatedly	O
.	O
</s>
<s>
The	O
bi-level	B-Algorithm
image	I-Algorithm
is	O
segmented	O
into	O
three	O
regions	O
:	O
text	O
,	O
halftone	O
,	O
and	O
generic	O
regions	O
.	O
</s>
<s>
A	O
human	O
observer	O
cannot	O
tell	O
the	O
difference	O
between	O
two	O
instances	O
of	O
the	O
same	O
characters	O
in	O
a	O
bi-level	B-Algorithm
image	I-Algorithm
even	O
though	O
they	O
may	O
not	O
exactly	O
match	O
pixel	O
by	O
pixel	O
.	O
</s>
<s>
The	O
encoder	O
performs	O
image	B-Algorithm
segmentation	I-Algorithm
to	O
isolate	O
character-sized	O
chunks	O
.	O
</s>
<s>
JBIG2	B-Algorithm
improves	O
on	O
PM&S	O
with	O
optional	O
soft	O
pattern	O
matching	O
(	O
SPM	O
)	O
.	O
</s>
<s>
The	O
same	O
segmentation	B-Algorithm
and	O
searching	O
is	O
performed	O
,	O
but	O
for	O
each	O
found	O
match	O
,	O
the	O
encoder	O
saves	O
not	O
only	O
the	O
corresponding	O
dictinary	O
entry	O
,	O
but	O
also	O
refinement	O
data	O
describing	O
the	O
difference	O
between	O
the	O
actual	O
chunk	O
and	O
the	O
dictinary	O
chunk	O
.	O
</s>
<s>
One	O
of	O
the	O
methods	O
is	O
similar	O
to	O
the	O
context-based	O
arithmetic	B-Algorithm
coding	I-Algorithm
algorithm	O
,	O
which	O
adaptively	O
positions	O
the	O
template	O
pixels	O
in	O
order	O
to	O
obtain	O
correlations	O
between	O
the	O
adjacent	O
pixels	O
.	O
</s>
<s>
All	O
three	O
region	O
types	O
including	O
text	O
,	O
halftone	O
,	O
and	O
generic	O
regions	O
may	O
all	O
use	O
arithmetic	B-Algorithm
coding	I-Algorithm
or	O
huffman	O
coding	O
.	O
</s>
<s>
JBIG2	B-Algorithm
specifically	O
uses	O
the	O
MQ	O
coder	O
,	O
the	O
same	O
entropy	O
encoder	O
employed	O
by	O
JPEG	O
2000	O
.	O
</s>
<s>
Patents	O
for	O
JBIG2	B-Algorithm
are	O
owned	O
by	O
IBM	O
and	O
Mitsubishi	O
.	O
</s>
<s>
JBIG	B-Application
and	O
JBIG2	B-Algorithm
patents	O
are	O
not	O
the	O
same	O
.	O
</s>
<s>
When	O
used	O
in	O
lossy	B-Algorithm
mode	O
,	O
JBIG2	B-Algorithm
compression	O
can	O
potentially	O
alter	O
text	O
in	O
a	O
way	O
that	O
's	O
not	O
discernible	O
as	O
corruption	O
.	O
</s>
<s>
This	O
is	O
in	O
contrast	O
to	O
some	O
other	O
algorithms	O
,	O
which	O
simply	O
degrade	O
into	O
a	O
blur	O
,	O
making	O
the	O
compression	B-Algorithm
artifacts	I-Algorithm
obvious	O
.	O
</s>
<s>
Since	O
JBIG2	B-Algorithm
tries	O
to	O
match	O
up	O
similar-looking	O
symbols	O
,	O
the	O
numbers	O
"	O
6	O
"	O
and	O
"	O
8	O
"	O
may	O
get	O
replaced	O
,	O
for	O
example	O
.	O
</s>
<s>
Numbers	O
printed	O
on	O
scanned	O
(	O
but	O
not	O
OCR-ed	O
)	O
documents	O
had	O
potentially	O
been	O
altered	O
.	O
</s>
<s>
This	O
has	O
been	O
demonstrated	O
on	O
construction	O
blueprints	B-Application
and	O
some	O
tables	O
of	O
numbers	O
;	O
the	O
potential	O
impact	O
of	O
such	O
substitution	O
errors	O
in	O
documents	O
such	O
as	O
medical	O
prescriptions	O
was	O
briefly	O
mentioned	O
.	O
</s>
<s>
Following	O
publicity	O
about	O
the	O
potential	O
for	O
errors	O
authorities	O
in	O
some	O
countries	O
made	O
statements	O
to	O
prevent	O
the	O
use	O
of	O
JBIG2	B-Algorithm
.	O
</s>
<s>
In	O
Germany	O
the	O
Federal	O
Office	O
for	O
Information	O
Security	O
has	O
issued	O
a	O
technical	O
guideline	O
that	O
says	O
the	O
JBIG2	B-Algorithm
encoding	O
"	O
MUST	O
NOT	O
be	O
used	O
"	O
for	O
"	O
replacement	O
scanning	O
"	O
.	O
</s>
<s>
In	O
Switzerland	O
the	O
Coordination	O
Office	O
for	O
the	O
Permanent	O
Archiving	O
of	O
Electronic	O
Documents	O
(	O
Koordinationsstelle	O
für	O
die	O
dauerhafte	O
Archivierung	O
elektronischer	O
Unterlagen	O
)	O
has	O
recommended	O
against	O
the	O
use	O
of	O
JBIG2	B-Algorithm
when	O
creating	O
PDF	B-Application
documents	I-Application
.	O
</s>
<s>
A	O
vulnerability	O
in	O
the	O
Xpdf	B-Protocol
implementation	O
of	O
JBIG2	B-Algorithm
,	O
re-used	O
in	O
Apple	O
's	O
iOS	B-Application
phone	O
operating	O
software	O
,	O
was	O
used	O
by	O
the	O
Pegasus	B-Application
spyware	I-Application
to	O
implement	O
a	O
zero-click	O
attack	O
on	O
iPhones	B-Device
by	O
constructing	O
an	O
emulated	O
computer	B-General_Concept
architecture	I-General_Concept
inside	O
a	O
JBIG2	B-Algorithm
stream	O
.	O
</s>
<s>
Apple	O
fixed	O
this	O
"	O
FORCEDENTRY	B-Application
"	O
vulnerability	O
in	O
iOS	B-Application
14.8	O
in	O
September	O
2021	O
.	O
</s>
