Plan 9 from Bell Labs’s /usr/web/sources/contrib/pac/sys/doc/netpbm/ms/pamtojpeg2k.ms

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.TL
Pamtojpeg2k User Manual
.SH 1
PAMTOJPEG2K
.LP
Updated: 27 October 2002
.br
Table Of Contents
.SH 2
NAME
.LP
pamtojpeg2k - convert PAM/PNM image to a JPEG-2000 code stream
.SH 2
SYNOPSIS
.LP
\fBpamtojpeg2k\fR
[\fB-imgareatlx=\fR\fIcolumn\fR]
[\fB-imgareatly=\fR\fIrow\fR]
[\fB-tilegrdtlx=\fR\fIcolumn\fR]
[\fB-tilegrdtly=\fR\fIrow\fR]
[\fB-tilewidth=\fR\fIcolumns\fR]
[\fB-tileheight=\fR\fIrows\fR]
[\fB-prcwidth=\fR\fIcolumns\fR]
[\fB-prcheight=\fR\fIrows\fR]
[\fB-cblkwidth=\fR\fIcolumns\fR]
[\fB-cblkheight=\fR\fIrows\fR]
[\fB-mode=\fR{\fBinteger\fR|\fBint\fR|\fBreal\fR}]
[\fB-compression=\fR\fIratio\fR]
[\fB-ilyrrates=\fR\fIratestring\fR]
[\fB-numrlvls=\fR\fInumber\fR]
[\fB-progression=\fR{\fBlrcp\fR|\fBrlcp\fR|\fBrpcl\fR|\fBpcrl\fR|\fBcprl\fR}]
[\fB-numgbits=\fR\fInumber\fR]
[\fB-nomct\fR]
[\fB-sop\fR]
[\fB-eph\fR]
[\fB-lazy\fR]
[\fB-termall\fR]
[\fB-segsym\fR]
[\fB-vcausal\fR]
[\fB-pterm\fR]
[\fB-resetprob\fR]
[\fB-verbose\fR]
[\fB-debuglevel=\fR\fInumber\fR]
\fIfilename\fR
.LP
Minimum unique abbreviation of option is acceptable.  You may use double
hyphens instead of single hyphen to denote options.  You may use white
space in place of the equals sign to separate an option name from its value.
.SH 2
DESCRIPTION
.LP
.LP
This program is part of Netpbm.
.LP
\fBpamtojpeg2k\fR converts the named PBM, PGM, PPM, or PAM file,
or Standard Input if no file is named, to a JPEG-2000 code stream
(JPC) file on Standard Output.
.LP
The JPEG-2000 specification specifies two different formats: JP2
and JPEG-2000 code stream (JPC).  JP2 represents a visual image quite
specifically, whereas JPC is a more or less arbitrary array of codes.
\fBpamtojpeg2k\fR can't produce a JP2, but the JPC image that
\fBpamtojpeg2k\fR produces is very similar to a JP2 if the input is a
PBM, PGM, or PPM image or equivalent PAM image.  One difference is
that that RGB intensity values in a JP2 are SRGB values, while
\fBpamtojpeg2k\fR produces ITU-R Recommedation BT.709 values.  Those
are very similar, but not identical.  Another difference is that a JP2
can contain extra information about an image that JPC cannot.
.LP
When the input is a PAM image other than a PBM, PGM, or PPM equivalent,
the JPC raster produced contains whatever the PAM raster does.  It can have
any number of planes with any meanings; the planes are in the same order in
the JPC output as in the PAM input.
.LP
A JPC image has a "precision," which is the number of bits used for
each code (in Netpbm lingo, "sample").  Actually, it has a separate
precision for each component.  \fBpamtojpeg2k\fR uses for the
precision of every component the least number of bits that can
represent the maxval of the input image.  A JPC image does not have an
independent concept of maxval; the maxval of a JPC sample is the
maximum value that the number of bits specified by the precision can
represent in pure binary code.  E.g. if the precision is 4, the maxval
is 15.  \fBpamtojpeg2k\fR does of course scale the sample values from
the input maxval to the output maxval.  Example: The input maxval is
99.  This means JPC precision is 7 bits and the JPC maxval is 127.  A
sample value of 33 in the input becomes a sample value of 43 in the
output.
.LP
\fBpamtojpeg2k\fR generates the JPC output with the Jasper JPEG-2000
library.  See documentation of the library for details on what
\fBpamtojpeg2k\fR produces.  Note that the Jasper library contains
facilities for reading PNM images, but \fBpamtojpeg2k\fR does not use
those.  It uses the Netpbm library instead.  Note that the makers of
the Jasper library write it "JasPer," but Netpbm documentation follows
standard American English typography rules, which don't allow that
kind of capitalization.
.LP
Use \fBjpeg2ktopam\fR to convert in the other direction.
.LP
The program \fBjasper\fR, which is packaged with the Jasper 
JPEG-2000 library, also converts between JPEG-2000 and PNM formats.
Because it's packaged with the library, it may exploit it better, 
especially recently added features.  However, since it does not use the
Netpbm library to read and write the Netpbm formats, it doesn't do as
good a job on that side.
.SH 2
OPTIONS
.LP
Most of the options are identical in name and function to options that the
Jasper library JPC encoder subroutine takes.  See
Jasper documentation
for details.  Here, we document only options that are not direct analogs
of Jasper options.
.RS
.IP "\fB-compression=\fR\fIratio\fR"
\fIratio\fR is a floating point number that specifies the compression
ratio.  \fBpamtojpeg2k\fR will adjust quality as necessary to ensure that
you get this compression ratio.  E.g. 4 means the output will be about
one fourth the size in bytes of the input file.
.LP
The compression ratio must be at least 1.  The default is 1, which means
the output has all the quality of the input -- the conversion is lossless.
.LP
Note that though Jasper library takes a compression factor, this
option specifies a compression ratio.  The compression factor is the
multiplicative inverse of (1 divided by) the compression ratio.
.IP "\fB-verbose\fR"
This option causes \fBpamtojpeg2k\fR to issue informational messages about
the conversion process.
.IP "\fB-debuglevel\fR=\fInumber\fR"
This option controls debug messages from the Jasper library.  
\fBpamtojpeg2k\fR passes \fInumber\fR as the debug level to the Jasper
JPC encoder.
.RE
.SH 2
EXAMPLES
.LP
.LP
This example compresses losslessly.
.DS L
  pamtojpeg2k myimg.ppm >myimg.jpc
.DE
\fBjpeg2ktopam\fR will recreate myimg.ppm exactly.
.LP
This example compresses the file to one tenth its original size, throwing
away information as necessary.
.DS L
  pamtojpeg2k -compression=10 myimg.pgm >myimg.jpc
.DE
.SH 2
ABOUT JPEG-2000
.LP
.LP
JPEG-2000 is a format that compresses a visual image (or a similar set of
data) into a minimal number of bytes for storage or transmission.  In that,
its goal is similar to JPEG.  It has two main differences from JPEG.  
.LP
One difference is that it does a much better job on most images of
throwing out information in order to achieve a smaller output.  That
means when you reconstruct the image from the resulting compressed
file, it looks a lot closer to the image you started with with
JPEG-2000 than with JPEG, for the same compressed file size.  Or, looked
at another way, with JPEG-2000 you get a much smaller file than with 
JPEG for the same image quality.
.LP
The second difference is that with JPEG-2000, you decide how much
compression you want and the compressor adjusts the quality to meet your
requirement, whereas with JPEG, you decide how much quality you want
and the compressor adjusts the size of the output to meet your requirement.
I.e. with JPEG-2000, the quality of the result depends on the compressibility
of the input, but with JPEG, the size of the result depends on
the compressibility of the input.
.LP
With JPEG-2000, you can specify lossless compression, thus making it 
compete with GIF and PNG.  With standard JPEG, you always lose something.
(There are rumored to be variations of JPEG around that are lossless,
though).
.LP
JPEG is much older than JPEG-2000 and far more popular.  JPEG is one of
the half dozen most popular graphics formats and virtually all graphics
facilities understand it.  JPEG-2000 is virtually unknown.
.LP
There is no compatibility between JPEG and JPEG-2000.  Programs that 
read JPEG do not automatically read JPEG-2000 and vice versa.
.SH 2
SEE ALSO
.LP
\fBjpeg2ktopam\fR,
\fBpnmtopeg\fR,
\fBppm\fR,
\fBpgm\fR,
\fBpbm\fR,
\fBpam\fR,
.SH 2
History
.LP
.LP
\fBpamtojpeg2k\fR was added to Netpbm in Release 10.12 (November 2002).
.br
\l'5i'
.SH 2
Table Of Contents
.LP
.IP \(bu
SYNOPSIS
.IP \(bu
DESCRIPTION
.IP \(bu
OPTIONS
.IP \(bu
EXAMPLES
.IP \(bu
ABOUT JPEG-2000
.IP \(bu
SEE ALSO
.LP

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.