1Pamtojpeg2k User Manual(0) Pamtojpeg2k User Manual(0)
2
3
4
6 pamtojpeg2k - convert PAM/PNM image to a JPEG-2000 code stream
7
8
10 pamtojpeg2k [-imgareatlx=column] [-imgareatly=row] [-tilegrdtlx=column]
11 [-tilegrdtly=row] [-tilewidth=columns] [-tileheight=rows]
12 [-prcwidth=columns] [-prcheight=rows] [-cblkwidth=columns]
13 [-cblkheight=rows] [-mode={integer|int|real}] [-compression=ratio]
14 [-ilyrrates=ratestring] [-numrlvls=number] [-progres‐
15 sion={lrcp|rlcp|rpcl|pcrl|cprl}] [-numgbits=number] [-nomct] [-sop]
16 [-eph] [-lazy] [-termall] [-segsym] [-vcausal] [-pterm] [-resetprob]
17 [-verbose] [-debuglevel=number] filename
18
19 Minimum unique abbreviation of option is acceptable. You may use dou‐
20 ble hyphens instead of single hyphen to denote options. You may use
21 white space in place of the equals sign to separate an option name from
22 its value.
23
24
25
27 This program is part of Netpbm(1).
28
29 pamtojpeg2k converts the named PBM, PGM, PPM, or PAM file, or Standard
30 Input if no file is named, to a JPEG-2000 code stream (JPC) file on
31 Standard Output.
32
33 The JPEG-2000 specification specifies two separate formats: JP2 and
34 JPEG-2000 code stream (JPC). JP2 represents a visual image quite
35 specifically, whereas JPC is a more or less arbitrary array of codes.
36 pamtojpeg2k can't produce a JP2, but the JPC image that pamtojpeg2k
37 produces is very similar to a JP2 if the input is a PBM, PGM, or PPM
38 image or equivalent PAM image. One difference is that the RGB inten‐
39 sity values in a JP2 are SRGB values, while pamtojpeg2k produces ITU-R
40 Recommendation BT.709 values. Those are very similar, but not identi‐
41 cal. Another difference is that a JP2 can contain extra information
42 about an image that JPC cannot.
43
44 When the input is a PAM image other than a PBM, PGM, or PPM equivalent,
45 the JPC raster produced contains whatever the PAM raster does. It can
46 have any number of planes with any meanings; the planes are in the same
47 order in the JPC output as in the PAM input.
48
49 A JPC image has a "precision," which is the number of bits used for
50 each code (in Netpbm lingo, "sample"). Actually, it has a separate
51 precision for each component. pamtojpeg2k uses for the precision of
52 every component the least number of bits that can represent the maxval
53 of the input image. A JPC image does not have an independent concept
54 of maxval; the maxval of a JPC sample is the maximum value that the
55 number of bits specified by the precision can represent in pure binary
56 code. E.g. if the precision is 4, the maxval is 15. pamtojpeg2k does
57 of course scale the sample values from the input maxval to the output
58 maxval. Example: The input maxval is 99. This means JPC precision is
59 7 bits and the JPC maxval is 127. A sample value of 33 in the input
60 becomes a sample value of 43 in the output.
61
62 pamtojpeg2k generates the JPC output with the Jasper JPEG-2000 library
63 ⟨http://www.ece.uvic.ca/~mdadams/jasper/⟩ . See documentation of the
64 library for details on what pamtojpeg2k produces. Note that the Jasper
65 library contains facilities for reading PNM images, but pamtojpeg2k
66 does not use those. It uses the Netpbm library instead. Note that the
67 makers of the Jasper library write it "JasPer," but Netpbm documenta‐
68 tion follows standard American English typography rules, which don't
69 allow that kind of capitalization.
70
71 Use jpeg2ktopam to convert in the other direction.
72
73 The program jasper, which is packaged with the Jasper JPEG-2000 li‐
74 brary, also converts between JPEG-2000 and PNM formats. Because it's
75 packaged with the library, it may exploit it better, especially re‐
76 cently added features. However, since it does not use the Netpbm li‐
77 brary to read and write the Netpbm formats, it doesn't do as good a job
78 on that side.
79
80 Another format with goals similar to those of JPEG-2000 but that allows
81 for faster encoding and decoding, is JPEG-LS. CharLS
82 ⟨http://charls.codeplex.com⟩ is a package of software for using JPEG-
83 LS.
84
85
86
88 In addition to the options common to all programs based on libnetpbm
89 (most notably -quiet, see
90 Common Options ⟨index.html#commonoptions⟩ ), pamtojpeg2k recognizes
91 the following command line options:
92
93
94 Jasper Library Options
95 These options are identical in name and function to options that the
96 Jasper library JPC encoder subroutine takes. See Jasper documentation
97 ⟨http://www.ece.uvic.ca/~mdadams/jasper/⟩ for details.
98
99
100
101 -imgareatlx=column
102
103 -imgareatly=row
104
105 -tilegrdtlx=column
106
107 -tilegrdtly=row
108
109 -tilewidth=columns
110
111 -tileheight=rows
112
113 -prcwidth=columns
114
115 -prcheight=rows
116
117 -cblkwidth=columns
118
119 -cblkheight=rows
120
121 -mode={integer|int|real}
122
123 -ilyrrates=ratestring
124
125 -numrlvls=number
126
127 -progression={lrcp|rlcp|rpcl|pcrl|cprl}
128
129 -numgbits=number
130
131 -nomct
132
133 -sop
134
135 -eph
136
137 -lazy
138
139 -termall
140
141 -segsym
142
143 -vcausal
144
145 -pterm
146
147 -resetprob
148
149
150
151 Other Options
152 -compression=ratio
153 ratio is a floating point number that specifies the compression
154 ratio. pamtojpeg2k will adjust quality as necessary to ensure
155 that you get this compression ratio. E.g. 4 means the output
156 will be about one fourth the size in bytes of the input file.
157
158 The ratio concerns just the raster part of the image, with the
159 denominator being what the raster would take if it were encoded
160 the most naive way possible (e.g. 3 bytes per pixel in 8-bit-
161 per-sample RGB). It does, however, include metadata that is
162 part of the compressed raster. Because of that, it may not be
163 possible to give you your requested compression ratio at any
164 quality. If it isn't, pamtojpeg2k fails with a message saying
165 so.
166
167 If you don't specify this option, pamtojpeg2k gives you the best
168 compression it can without losing any quality. Because of the
169 metadata issue described above, this may mean, for a small im‐
170 age, the image actually expands.
171
172 Note that though the Jasper library takes a compression factor,
173 this option specifies a compression ratio. The compression fac‐
174 tor is the multiplicative inverse of (1 divided by) the compres‐
175 sion ratio.
176
177 Before Netpbm 10.61 (December 2012), the default was a compres‐
178 sion ratio of 1, and if pamtojpeg2k could not make the output
179 that small, it just made it as small as it could, with zero
180 quality. You know this is happening when you see the warning
181 message, "empty layer generated."
182
183
184 -verbose
185 This option causes pamtojpeg2k to issue informational messages
186 about the conversion process.
187
188
189 -debuglevel=number
190 This option controls debug messages from the Jasper library.
191 pamtojpeg2k passes number as the debug level to the Jasper JPC
192 encoder.
193
194
195
196
198 This example compresses losslessly.
199
200 pamtojpeg2k myimg.ppm >myimg.jpc
201
202
203 jpeg2ktopam will recreate myimg.ppm exactly.
204
205 This example compresses the file to one tenth its original size, throw‐
206 ing away information as necessary.
207
208 pamtojpeg2k -compression=10 myimg.pgm >myimg.jpc
209
210
211
212
214 JPEG-2000 is a format that compresses a visual image (or a similar set
215 of data) into a minimal number of bytes for storage or transmission.
216 In that, its goal is similar to JPEG. It has two main differences from
217 JPEG.
218
219 One difference is that it does a much better job on most images of
220 throwing out information in order to achieve a smaller output. That
221 means when you reconstruct the image from the resulting compressed
222 file, it looks a lot closer to the image you started with JPEG-2000
223 than with JPEG, for the same compressed file size. Or, looked at an‐
224 other way, with JPEG-2000 you get a much smaller file than with JPEG
225 for the same image quality.
226
227 The second difference is that with JPEG-2000, you decide how much com‐
228 pression you want and the compressor adjusts the quality to meet your
229 requirement, whereas with JPEG, you decide how much quality you want
230 and the compressor adjusts the size of the output to meet your require‐
231 ment. I.e. with JPEG-2000, the quality of the result depends on the
232 compressibility of the input, but with JPEG, the size of the result de‐
233 pends on the compressibility of the input.
234
235 With JPEG-2000, you can specify lossless compression, thus making it
236 compete with GIF and PNG. With standard JPEG, you always lose some‐
237 thing. (There are rumored to be variations of JPEG around that are
238 lossless, though).
239
240 JPEG is much older than JPEG-2000 and far more popular. JPEG is one of
241 the half dozen most popular graphics formats and virtually all graphics
242 facilities understand it. JPEG-2000 is virtually unknown.
243
244 There is no compatibility between JPEG and JPEG-2000. Programs that
245 read JPEG do not automatically read JPEG-2000 and vice versa.
246
247
248
250 jpeg2ktopam(1), pnmtojpeg(1), ppm(1), pgm(1), pbm(1), pam(1),
251
252
254 pamtojpeg2k was added to Netpbm in Release 10.12 (November 2002).
255
257 This manual page was generated by the Netpbm tool 'makeman' from HTML
258 source. The master documentation is at
259
260 http://netpbm.sourceforge.net/doc/pamtojpeg2k.html
261
262netpbm documentation 31 January 2014 Pamtojpeg2k User Manual(0)