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
74 library, also converts between JPEG-2000 and PNM formats. Because it's
75 packaged with the library, it may exploit it better, especially
76 recently added features. However, since it does not use the Netpbm
77 library to read and write the Netpbm formats, it doesn't do as good a
78 job 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 Most of the options are identical in name and function to options that
89 the Jasper library JPC encoder subroutine takes. See Jasper
90 documentation ⟨http://www.ece.uvic.ca/~mdadams/jasper/⟩ for details.
91 Here, we document only options that are not direct analogs of Jasper
92 options.
93
94
95
96
97 -compression=ratio
98 ratio is a floating point number that specifies the compression
99 ratio. pamtojpeg2k will adjust quality as necessary to ensure
100 that you get this compression ratio. E.g. 4 means the output
101 will be about one fourth the size in bytes of the input file.
102
103 The ratio concerns just the raster part of the image, with the
104 denominator being what the raster would take if it were encoded
105 the most naive way possible (e.g. 3 bytes per pixel in 8-bit-
106 per-sample RGB). It does, however, include metadata that is
107 part of the compressed raster. Because of that, it may not be
108 possible to give you your requested compression ratio at any
109 quality. If it isn't, pamtojpeg2k fails with a message saying
110 so.
111
112 If you don't specify this option, pamtojpeg2k gives you the best
113 compression it can without losing any quality. Because of the
114 metadata issue described above, this may mean, for a small
115 image, the image actually expands.
116
117 Note that though the Jasper library takes a compression factor,
118 this option specifies a compression ratio. The compression fac‐
119 tor is the multiplicative inverse of (1 divided by) the compres‐
120 sion ratio.
121
122 Before Netpbm 10.61 (December 2012), the default was a compres‐
123 sion ratio of 1, and if pamtojpeg2k could not make the output
124 that small, it just made it as small as it could, with zero
125 quality. You know this is happening when you see the warning
126 message, "empty layer generated."
127
128
129 -verbose
130 This option causes pamtojpeg2k to issue informational messages
131 about the conversion process.
132
133
134 -debuglevel=number
135 This option controls debug messages from the Jasper library.
136 pamtojpeg2k passes number as the debug level to the Jasper JPC
137 encoder.
138
139
140
141
143 This example compresses losslessly.
144
145 pamtojpeg2k myimg.ppm >myimg.jpc
146
147 jpeg2ktopam will recreate myimg.ppm exactly.
148
149 This example compresses the file to one tenth its original size, throw‐
150 ing away information as necessary.
151
152 pamtojpeg2k -compression=10 myimg.pgm >myimg.jpc
153
154
155
157 JPEG-2000 is a format that compresses a visual image (or a similar set
158 of data) into a minimal number of bytes for storage or transmission.
159 In that, its goal is similar to JPEG. It has two main differences from
160 JPEG.
161
162 One difference is that it does a much better job on most images of
163 throwing out information in order to achieve a smaller output. That
164 means when you reconstruct the image from the resulting compressed
165 file, it looks a lot closer to the image you started with JPEG-2000
166 than with JPEG, for the same compressed file size. Or, looked at
167 another way, with JPEG-2000 you get a much smaller file than with JPEG
168 for the same image quality.
169
170 The second difference is that with JPEG-2000, you decide how much com‐
171 pression you want and the compressor adjusts the quality to meet your
172 requirement, whereas with JPEG, you decide how much quality you want
173 and the compressor adjusts the size of the output to meet your require‐
174 ment. I.e. with JPEG-2000, the quality of the result depends on the
175 compressibility of the input, but with JPEG, the size of the result
176 depends on the compressibility of the input.
177
178 With JPEG-2000, you can specify lossless compression, thus making it
179 compete with GIF and PNG. With standard JPEG, you always lose some‐
180 thing. (There are rumored to be variations of JPEG around that are
181 lossless, though).
182
183 JPEG is much older than JPEG-2000 and far more popular. JPEG is one of
184 the half dozen most popular graphics formats and virtually all graphics
185 facilities understand it. JPEG-2000 is virtually unknown.
186
187 There is no compatibility between JPEG and JPEG-2000. Programs that
188 read JPEG do not automatically read JPEG-2000 and vice versa.
189
190
191
193 jpeg2ktopam(1), pnmtojpeg(1), ppm(1), pgm(1), pbm(1), pam(1),
194
195
197 pamtojpeg2k was added to Netpbm in Release 10.12 (November 2002).
198
200 This manual page was generated by the Netpbm tool 'makeman' from HTML
201 source. The master documentation is at
202
203 http://netpbm.sourceforge.net/doc/pamtojpeg2k.html
204
205netpbm documentation 31 January 2014 Pamtojpeg2k User Manual(0)