1Pamtojpeg2k User Manual(0)                          Pamtojpeg2k User Manual(0)
2
3
4

NAME

6       pamtojpeg2k - convert PAM/PNM image to a JPEG-2000 code stream
7
8

SYNOPSIS

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       [-size=bytes]   [-ilyrrates=[realnumber[,realnumber,   ...]]    [-numr‐
15       lvls=number] [-progression={lrcp|rlcp|rpcl|pcrl|cprl}]  [-numgbits=num‐
16       ber]  [-nomct]  [-sop]  [-eph]  [-lazy] [-termall] [-segsym] [-vcausal]
17       [-pterm] [-resetprob] [-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

DESCRIPTION

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
63http://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
82http://charls.codeplex.com⟩  is a package of software for using  JPEG-
83       LS.
84
85
86

OPTIONS

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
97http://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=[realnumber[,realnumber, ...]]
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       -ilyrrates ('intermediate layer rates') lets you control
151         the  compression  at each layer.  The compressed image is arranged in
152       layers,
153         so if you transmit it somewhere serially, enough information to  make
154       a low
155         quality  image  arrives  soon, then later more information arrives to
156       improve
157         the quality of the image, and so on until the entire  image  arrives.
158       The
159         value of this option is a list of ascending fractions, such as
160         '.1,.3,.5'.  Each fraction says the size of the layers up to and
161         including  that  layer  should add up to that fraction of the size of
162       the input
163         image.  If the size of the entire image is limited by -compression
164         or -size, none of these numbers may exceed that limit.
165
166
167   Other Options
168       -compression=ratio
169              ratio is a floating point number that specifies the  compression
170              ratio.   pamtojpeg2k  will adjust quality as necessary to ensure
171              that you get this compression ratio.  E.g. 4  means  the  output
172              will be about one fourth the size in bytes of the input file.
173
174              The  ratio  concerns just the raster part of the image, with the
175              denominator being what the raster would take if it were  encoded
176              the  most  naive  way possible (e.g. 3 bytes per pixel in 8-bit-
177              per-sample RGB).  It does, however,  include  metadata  that  is
178              part  of  the compressed raster.  Because of that, it may not be
179              possible to give you your requested  compression  ratio  at  any
180              quality.   If  it isn't, pamtojpeg2k fails with a message saying
181              so.
182
183              If you don't specify this option, pamtojpeg2k gives you the best
184              compression  it  can without losing any quality.  Because of the
185              metadata issue described above, this may mean, for a  small  im‐
186              age, the image actually expands.
187
188              This  option  controls  the 'rate' option of the Jasper library.
189              Note that though the Jasper library takes a compression  factor,
190              this option specifies a compression ratio.  The compression fac‐
191              tor is the multiplicative inverse of (1 divided by) the compres‐
192              sion ratio.
193
194              You may not specify this with -size.
195
196              Before  Netpbm 10.61 (December 2012), the default was a compres‐
197              sion ratio of 1, and if pamtojpeg2k could not  make  the  output
198              that  small,  it  just  made  it as small as it could, with zero
199              quality.  You know this is happening when you  see  the  warning
200              message, "empty layer generated."
201
202
203       -size=bytes
204              This  option  specifies  the  maximum size in bytes you want the
205              output image to have.  This size is  all-in,  including  headers
206              and  trailers and other metadata.  pamtojpeg2k will omit as much
207              information as necessary to get under this limit.
208
209              It is possible to specify a value impossibly small, for  example
210              a  value that doesn't even leave room for the image header.
211              If you do this, the program fails with an explanatory message.
212
213              This option controls the 'rate' option of the Jasper library.
214
215              You may not specify this with -compression.
216
217              This option was new in Netpbm 11.1 (December 2022).
218
219
220
221       -verbose
222              This option causes pamtojpeg2k to issue  informational  messages
223              about the conversion process.
224
225
226       -debuglevel=number
227              This  option  controls  debug  messages from the Jasper library.
228              pamtojpeg2k passes number as the debug level to the  Jasper  JPC
229              encoder.
230
231
232
233

EXAMPLES

235       This example compresses losslessly.
236
237         pamtojpeg2k myimg.ppm >myimg.jpc
238
239
240       jpeg2ktopam will recreate myimg.ppm exactly.
241
242       This example compresses the file to one tenth its original size, throw‐
243       ing away information as necessary.
244
245         pamtojpeg2k -compression=10 myimg.pgm >myimg.jpc
246
247
248
249

ABOUT JPEG-2000

251       JPEG-2000 is a format that compresses a visual image (or a similar  set
252       of  data)  into  a minimal number of bytes for storage or transmission.
253       In that, its goal is similar to JPEG.  It has two main differences from
254       JPEG.
255
256       One  difference  is  that  it  does a much better job on most images of
257       throwing out information in order to achieve a  smaller  output.   That
258       means  when  you  reconstruct  the  image from the resulting compressed
259       file, it looks a lot closer to the image  you  started  with  JPEG-2000
260       than  with  JPEG, for the same compressed file size.  Or, looked at an‐
261       other way, with JPEG-2000 you get a much smaller file  than  with  JPEG
262       for the same image quality.
263
264       The  second difference is that with JPEG-2000, you decide how much com‐
265       pression you want and the compressor adjusts the quality to  meet  your
266       requirement,  whereas  with  JPEG, you decide how much quality you want
267       and the compressor adjusts the size of the output to meet your require‐
268       ment.   I.e.  with  JPEG-2000, the quality of the result depends on the
269       compressibility of the input, but with JPEG, the size of the result de‐
270       pends on the compressibility of the input.
271
272       With  JPEG-2000,  you  can specify lossless compression, thus making it
273       compete with GIF and PNG.  With standard JPEG, you  always  lose  some‐
274       thing.   (There  are  rumored  to be variations of JPEG around that are
275       lossless, though).
276
277       JPEG is much older than JPEG-2000 and far more popular.  JPEG is one of
278       the half dozen most popular graphics formats and virtually all graphics
279       facilities understand it.  JPEG-2000 is virtually unknown.
280
281       There is no compatibility between JPEG and  JPEG-2000.   Programs  that
282       read JPEG do not automatically read JPEG-2000 and vice versa.
283
284
285

SEE ALSO

287       jpeg2ktopam(1), pnmtojpeg(1), ppm(1), pgm(1), pbm(1), pam(1),
288
289

HISTORY

291       pamtojpeg2k was added to Netpbm in Release 10.12 (November 2002).
292

DOCUMENT SOURCE

294       This  manual  page was generated by the Netpbm tool 'makeman' from HTML
295       source.  The master documentation is at
296
297              http://netpbm.sourceforge.net/doc/pamtojpeg2k.html
298
299netpbm documentation            1 November 2022     Pamtojpeg2k User Manual(0)
Impressum