1PBMTOJBG(1) General Commands Manual PBMTOJBG(1)
2
3
4
6 pbmtojbg - portable bitmap to JBIG1 file converter
7
9 pbmtojbg [ options ] [ input-file | - [ output-file ]]
10
12 Reads in a portable bitmap (PBM) from a file or standard input, com‐
13 presses it, and outputs the image as a JBIG1 bi-level image entity
14 (BIE) file.
15
16 JBIG1 is a highly effective lossless compression algorithm for bi-level
17 images (one bit per pixel), which is particularly suitable for scanned
18 document pages.
19
20 A JBIG1 encoded image can be stored in several resolutions (progressive
21 mode). These resolution layers can be stored all in one single BIE or
22 they can be stored in several separate BIE files. All resolution lay‐
23 ers except the lowest one are stored merely as differences to the next
24 lower resolution layer, because this requires less space than encoding
25 the full image completely every time. Each resolution layer has twice
26 the number of horizontal and vertical pixels than the next lower layer.
27 JBIG1 files can also store several bits per pixel as separate bitmap
28 planes, and pbmtojbg can read a PGM file and transform it into a multi-
29 bitplane BIE.
30
31
33 - A single hyphen instead of an input file name will cause
34 pbmtojbg to read the data from standard input instead
35 from a file.
36
37 -q Encode the image in one single resolution layer (sequen‐
38 tial mode). This is usually the most efficient compres‐
39 sion method. By default, the number of resolution layers
40 is chosen automatically such that the lowest layer image
41 is not larger than 640 × 480 pixels. This is a shortcut
42 for -d 0.
43
44 -x number Specify the maximal horizontal size of the lowest resolu‐
45 tion layer. The default is 640 pixels.
46
47 -y number Specify the maximal vertical size of the lowest resolu‐
48 tion layer. The default is 480 pixels.
49
50 -l number Select the lowest resolution layer that will be written
51 to the BIE. It is possible to store the various resolu‐
52 tion layers of a JBIG1 image in progressive mode into
53 different BIEs. Options -l and -h allow to select the
54 resolution-layer interval that will appear in the created
55 BIE. The lowest resolution layer has number 0 and this is
56 also the default value. By default all layers will be
57 written.
58
59 -h number Select the highest resolution layer that will be written
60 to the BIE. By default all layers will be written. See
61 also option -l.
62
63 -b Use binary values instead of Gray code words in order to
64 encode pixel values in multiple bitplanes. This option
65 has only an effect if the input is a PGM file and if more
66 than one bitplane is produced. Note that the decoder has
67 to make the same selection but cannot determine from the
68 BIE, whether Gray or binary code words were used by the
69 encoder.
70
71 -d number Specify the total number of differential resolution lay‐
72 ers into which the input image will be split in addition
73 to the lowest layer. Each additional layer reduces the
74 size of layer 0 by 50 %. This option overrides options -x
75 and -y which are usually a more comfortable way of
76 selecting the number of resolution layers.
77
78 -s number The JBIG1 algorithm splits each image into a number of
79 horizontal stripes. This option specifies that each
80 stripe shall have number lines in layer 0. The default
81 value is selected so that approximately 35 stripes will
82 be used for the whole image.
83
84 -m number Select the maximum horizontal offset of the adaptive tem‐
85 plate pixel. The JBIG1 encoder uses ten neighbour pixels
86 to estimate the probability of the next pixel being black
87 or white. It can move one out of these ten pixels. This
88 is especially useful for dithered images, as long as the
89 distance of this adaptive pixel can be adjusted to the
90 period of the dither pattern. By default, the adaptive
91 template pixel is allowed to move up to 8 pixels away
92 horizontally. This encoder supports distances up to 127
93 pixels. Annex A of the standard suggests that decoders
94 should support at least a horizontal distance of 16 pix‐
95 els, so using values not higher than 16 for number might
96 increase the chances of interoperability with other JBIG1
97 implementations. On the other hand, the T.85 fax applica‐
98 tion profile requires decoders to support horizontal off‐
99 sets up to 127 pixels, which the maximum value permitted
100 by the standard. (The maximal vertical offset of the
101 adaptive template pixel is always zero for this encoder.)
102
103 -t number Encode only the specified number of most significant bit
104 planes. This option allows to reduce the depth of an
105 input PGM file if not all bits per pixel are needed in
106 the output.
107
108 -o number JBIG1 separates an image into several horizontal stripes,
109 resolution layers and planes, were each plane contains
110 one bit per pixel. One single stripe in one plane and
111 layer is encoded as a data unit called stripe data entity
112 (SDE) inside the BIE. There are 12 different possible
113 orders in which the SDEs can be stored inside the BIE and
114 number selects which one shall be used. The order of the
115 SDEs is only relevant for applications that want to
116 decode a JBIG1 file which has not yet completely arrived
117 from e.g. a slow network connection. For instance some
118 applications prefer that the outermost of the three loops
119 (stripes, layers, planes) is over all layers so that all
120 data of the lowest resolution layer is transmitted first.
121 The following values for number select these loop
122 arrangements for writing the SDEs (outermost loop first):
123
124 0 planes, layers, stripes
125 2 layers, planes, stripes
126 3 layers, stripes, planes
127 4 stripes, planes, layers
128 5 planes, stripes, layers
129 6 stripes, layers, planes
130
131 All loops count starting with zero, however by adding 8
132 to the above order code, the layer loop can be reversed
133 so that it counts down to zero and then higher resolution
134 layers will be stored before lower layers. Default order
135 is 3 which writes at first all planes of the first stripe
136 and then completes layer 0 before continuing with the
137 next layer and so on.
138
139 -p number This option allows to activate or deactivate various
140 optional algorithms defined in the JBIG1 standard. Just
141 add the numbers of the following options which you want
142 to activate in order to get the number value:
143
144 4 deterministic prediction (DPON)
145 8 layer 0 typical prediction (TPBON)
146 16 diff. layer typ. pred. (TPDON)
147 64 layer 0 two-line template (LRLTWO)
148
149 Except for special applications (like communication with
150 JBIG1 subset implementations) and for debugging purposes
151 you will normally not want to change anything here. The
152 default is 28, which provides the best compression
153 result.
154
155 -C string Add the string in a comment marker segment to the pro‐
156 duced data stream. (There is no support at present for
157 adding comments that contain the zero byte.)
158
159 -c Determine the adaptive template pixel movement as sug‐
160 gested in annex C of the standard. By default the tem‐
161 plate change takes place directly in the next line, which
162 is most effective. However, a few conformance test exam‐
163 ples in the standard require the adaptive template change
164 to be delayed until the first line of the next stripe.
165 This option selects this special behavior, which is nor‐
166 mally not required except in order to pass some confor‐
167 mance tests.
168
169 -r Use the SDRST marker instead of the normal SDNORM marker.
170 The probably only useful application of this option is to
171 generate test data for checking whether a JBIG1 decoder
172 has implemented SDRST correctly. In a normal JBIG1 data
173 stream, each stripe data entity (SDE) is terminated by an
174 SDNORM marker, which preserves the state of the arith‐
175 metic encoder (and more) for the next stripe in the same
176 layer. The alternative SDRST marker resets this state at
177 the end of the stripe.
178
179 -Y number A long time ago, there were fax machines that couldn't
180 even hold a single page in memory. They had to start
181 transmitting data before the page was scanned in com‐
182 pletely and the length of the image was known. The
183 authors of the standard added a rather ugly hack to the
184 otherwise beautiful JBIG1 format to support this. The
185 NEWLEN marker segment can override the image height
186 stated in the BIE header anywhere later in the data
187 stream. Normally pbmtojbg never generates NEWLEN marker
188 segments, as it knows the correct image height when it
189 outputs the header. This option is solely intended for
190 the purpose of generating test files with NEWLEN marker
191 segments. It can be used to specify a higher initial
192 image height for use in the BIE header, and pbmtojbg will
193 then add a NEWLEN marker segment at the latest possible
194 opportunity to the data stream to signal the correct
195 final height.
196
197 -f This option makes the output file comply to the "facsim‐
198 ile application profile" defined in ITU-T Recommendation
199 T.85. It is a shortcut for -q -o 0 -p 8 -s 128 -t 1 -m
200 127.
201
202 -v After the BIE has been created, a few technical details
203 of the created file will be listed (verbose mode).
204
206 Using standard input and standard output for binary data works only on
207 systems where there is no difference between binary and text streams
208 (e.g., Unix). On other systems (e.g., MS-DOS), using standard input or
209 standard output may cause control characters like CR or LF to be
210 inserted or deleted and this will damage the binary data.
211
213 This program implements the JBIG1 image coding algorithm as specified
214 in ISO/IEC 11544:1993 and ITU-T T.82(1993).
215
217 The pbmtojbg program is part of the JBIG-KIT package, which has been
218 developed by Markus Kuhn. The most recent version of this portable
219 JBIG1 library and tools set is available from
220 <http://www.cl.cam.ac.uk/~mgk25/jbigkit/>.
221
223 pbm(5), pgm(5), jbgtopbm(1)
224
225
226
227 2003-06-04 PBMTOJBG(1)