1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
\
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
.\" Do not hand-hack it! If you have bug fixes or improvements, please find
.\" the corresponding HTML page on the Netpbm website, generate a patch
.\" against that, and send it to the Netpbm maintainer.
.TH "Pnmtojbig User Manual" 0 "28 July 2020" "netpbm documentation"
.SH NAME
pnmtojbig - PNM to JBIG file converter
.UN synopsis
.SH SYNOPSIS
\fBpnmtojbig\fP
[\fIoptions\fP]
[\fIinput-file\fP [\fIoutput-file\fP]]
.UN description
.SH DESCRIPTION
.PP
This program is part of
.BR "Netpbm" (1)\c
\&.
.PP
\fBpnmtojbig\fP reads a PBM or PGM image, compresses it, and
outputs the image as a JBIG bi-level image entity (BIE) file.
.PP
JBIG is a highly effective lossless compression algorithm for
bi-level images (one bit per pixel), which is particularly suitable
for scanned document pages.
.PP
A JBIG encoded image can be stored in several resolutions
(progressive mode). These resolution layers can be stored all in one
single BIE or they can be stored in several separate BIE files. All
resolution layers except the lowest one are stored merely as
differences to the next lower resolution layer, because this requires
less space than encoding the full image completely every time. Each
resolution layer has twice the number of horizontal and vertical
pixels than the next lower layer. JBIG files can also store several
bits per pixel as separate bitmap planes, and \fBpnmtojbig\fP
can read a PGM file and transform it into a multi-bitplane BIE.
.UN options
.SH OPTIONS
.PP
In addition to the options common to all programs based on libnetpbm
(most notably \fB-quiet\fP, see
.UR index.html#commonoptions
Common Options
.UE
\&), \fBpnmtojbig\fP recognizes the following
command line options:
.TP
\fB-q\fP
Encode the image in one single resolution layer (sequential
mode). This is usually the most efficient compression method. By
default, the number of resolution layers is chosen automatically such
that the lowest layer image is not larger than 640 \(mu 480 pixels.
.TP
\fB-x\fP \fInumber\fP
Specify the maximal horizontal size of the lowest resolution
layer. The default is 640 pixels.
.TP
\fB-y\fP \fInumber\fP
Specify the maximal vertical size of the lowest resolution layer.
The default is 480 pixels.
.TP
\fB-l\fP \fInumber\fP
Select the lowest resolution layer that will be written to the
BIE. It is possible to store the various resolution layers of a JBIG
image in progressive mode into different BIEs. Options \fB-l\fP and
\fB-h\fP allow you to select the resolution-layer interval that will
appear in the created BIE. The lowest resolution layer has number 0
and this is also the default value. By default, \fBpnmtojbig\fP
writes all layers.
.TP
\fB-h\fP \fInumber\fP
Select the highest resolution layer that will be written to the
BIE. By default, \fBpnmtojbig\fP writes all layers. See also option
\fB-l\fP.
.TP
\fB-b\fP
Use binary values instead of Gray code words in order to encode
pixel values in multiple bitplanes. This option has only an effect if
the input is a PGM file and if more than one bitplane is
produced. Note that the decoder has to make the same selection but
cannot determine from the BIE, whether Gray or binary code words were
used by the encoder.
.TP
\fB-d\fP \fInumber\fP
Specify the total number of differential resolution layers into
which the input image will be split in addition to the lowest layer.
Each additional layer reduces the size of layer 0 by 50 %. This
option overrides options \fB-x\fP and \fB-y\fP, which are usually a
more comfortable way of selecting the number of resolution layers.
.TP
\fB-s\fP \fInumber\fP
The JBIG algorithm splits each image into a number of horizontal
stripes. This option specifies that each stripe shall have
\fInumber\fP lines in layer 0. The default value is selected so that
approximately 35 stripes will be used for the whole image.
.TP
\fB-m\fP \fInumber\fP
Select the maximum horizontal offset of the adaptive template pixel. The
JBIG encoder uses a number of neighbour pixels in order to get statistical a
priori knowledge of the probability, whether the next pixel will be black or
white. One single pixel out of this template of context neighbor pixels can
be moved around. Especially for dithered images it can be a significant
advantage to have one neighbor pixel which has a distance large enough to
cover the period of a dither function. By default, the adaptive template
pixel can be moved up to 8 pixels away. This encoder go up to 23 pixels,
however as decoders are only required to handle at least a distance of 16
pixels by the standard, no higher value than 16 for
\fInumber\fP is recommended in order to maintain interoperability
with other JBIG implementations. The maximal vertical offset of the
adaptive template pixel is always zero.
.TP
\fB-t\fP \fInumber\fP
Encode only the specified number of most significant bit planes.
This option allows one to reduce the depth of an input PGM file if not all
bits per pixel are needed in the output.
.TP
\fB-o\fP \fInumber\fP
JBIG separates an image into several horizontal stripes,
resolution layers and planes, were each plane contains one bit per
pixel. One single stripe in one plane and layer is encoded as a data
unit called stripe data entity (SDE) inside the BIE. There are 12
different possible orders in which the SDEs can be stored inside the
BIE and \fInumber\fP selects which one shall be used. The order of
the SDEs is only relevant for applications that want to decode a JBIG
file which has not yet completely arrived from e.g. a slow network
connection. For instance some applications prefer that the outermost
of the three loops (stripes, layers, planes) is over all layers so
that all data of the lowest resolution layer is transmitted first.
.sp
The following values for \fInumber\fP select these loop
arrangements for writing the SDEs (outermost loop first):
.TP
0
planes, layers, stripes
.TP
2
layers, planes, stripes
.TP
3
layers, stripes, planes
.TP
4
stripes, planes, layers
.TP
5
planes, stripes, layers
.TP
6
stripes, layers, planes
.sp
All loops count starting with zero, however by adding 8 to the
above order code, the layer loop can be reversed so that it counts
down to zero and then higher resolution layers will be stored before
lower layers. Default order is 3 which writes at first all planes of
the first stripe and then completes layer 0 before continuing with the
next layer and so on.
.TP
\fB-p\fP \fInumber\fP
This option allows you to activate or deactivate various optional
algorithms defined in the JBIG standard. Just add the numbers of the
following options which you want to activate in order to get the
\fInumber\fP value:
.TP
4
deterministic prediction (DPON)
.TP
8
typical prediction (TPBON)
.TP
16
diff. layer typical prediction (TPDON)
.TP
64
layer 0 two-line template (LRLTWO)
.sp
Except for special applications (like communication with JBIG
subset implementations) and for debugging purposes you will normally
not want to change anything here. The default is 28, which provides
the best compression result.
.TP
\fB-c\fP
The adaptive template pixel movement is determined as suggested in
annex C of the standard. By default the template change takes place
directly in the next line which is most effective. However a few
conformance test examples in the standard require the adaptive
template change to be delayed until the first line of the next stripe.
This option selects this special behavior, which is normally not
required except in order to pass some conformance test suite.
.TP
\fB-v\fP
After \fBpnmtojbig\fP creates the BIE, it lists a few technical
details of the created file (verbose mode).
.UN formats
.SH FORMATS
.PP
Most of the format \fBpnmtojbig\fP creates is defined by the
JBIG standard.
.PP
The standard, however, does not specify which values in the BIE mean
white and which mean black. It contains a recommendation that for a
single plane image zero mean background and one mean foreground, but
the Netpbm formats have no concept of foreground and background. And
the standard says nothing about values for multiple plane BIEs.
.PP
\fBpnmtojbig\fP follows Markus Kuhn's implementation of the
standard in the \fBpbmtojbg\fP program that comes with his
JBIG library: If the BIE is a single plane BIE, zero means
white and one means black. If it is a multiple plane BIE, zero means
black and the maximal value is white.
.UN standards
.SH STANDARDS
.PP
This program implements the JBIG image coding algorithm as
specified in ISO/IEC 11544:1993 and ITU-T T.82(1993).
.UN author
.SH AUTHOR
\fBpnmtojbig\fP is based on the JBIG library by Markus Kuhn, part of
his \fBJBIG-KIT\fP package. The \fBpbmtojbg\fP program is part of
the \fIJBIG-KIT\fP package. The most recent version of that library
and tools set is freely available on the Internet from anonymous ftp
server
.UR ftp://ftp.informatik.uni-erlangen.de
ftp.informatik.uni-erlangen.de
.UE
\&
in directory pub/doc/ISO/JBIG/.
.PP
\fBpnmtojbig\fP is part of the Netpbm package of graphics tools.
.UN seealso
.SH SEE ALSO
.BR "pnm" (5)\c
\&,
.BR "jbigtopnm" (1)\c
\&
.UN license
.SH LICENSE
.PP
There was at one time concern about the need for patent licenses to
use \fBpnmtojbig\fP, but any relevant patents expired by 2012.
.SH DOCUMENT SOURCE
This manual page was generated by the Netpbm tool 'makeman' from HTML
source. The master documentation is at
.IP
.B http://netpbm.sourceforge.net/doc/pnmtojbig.html
.PP
|