451 lines
11 KiB
HTML
451 lines
11 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of JPEGTOPNM</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>JPEGTOPNM</H1>
|
|
Section: User Commands (1)<BR>Updated: 19 March 2000<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
jpegtopnm - convert JPEG/JFIF file to portable pixmap or graymap
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>jpegtopnm</B>
|
|
|
|
[<B>-dct</B>
|
|
|
|
{<B>int</B>|<B>fast</B>|<B>float</B>}]
|
|
|
|
[<B>-nosmooth</B>]
|
|
|
|
[<B>-maxmemory</B>
|
|
|
|
<I>N</I>]
|
|
|
|
[{<B>-adobe</B>|<B>-notadobe</B>}]
|
|
|
|
[<B>-comments</B>]
|
|
|
|
[<B>-dumpexif</B>]
|
|
|
|
[<B>-exif=</B><I>filespec</I>]
|
|
|
|
[<B>-verbose</B>]
|
|
|
|
[<B>-tracelevel</B>
|
|
|
|
<I>N</I>]
|
|
|
|
[
|
|
<I>filename</I>
|
|
|
|
]
|
|
<P>
|
|
All options may be abbreviated to their shortest unique prefix.
|
|
<P>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
<B>jpegtopnm</B>
|
|
|
|
converts the named JFIF file, or the standard input if no file is
|
|
named to a PPM or PGM image file on the standard output. If the JFIF
|
|
file is of the grayscale variety,
|
|
<B>jpegtopnm</B>
|
|
|
|
generates a PGM (Portable Graymap) file. Otherwise, it generates a
|
|
PPM (Portable Pixmap) file.
|
|
<P>
|
|
|
|
<B>jpegtopnm</B>
|
|
|
|
uses the Independent JPEG Group's JPEG library to interpret the input file.
|
|
See
|
|
<B><A HREF="http://www.ijg.org">http://www.ijg.org</A> </B>
|
|
|
|
for information on the library.
|
|
<P>
|
|
"JFIF" is the correct name for the image format commonly known as "JPEG."
|
|
Strictly speaking, JPEG is a method of compression. The image format
|
|
using JPEG compression that is by far the most common is JFIF. There is
|
|
also a subformat of TIFF that uses JPEG compression.
|
|
<P>
|
|
EXIF is an image format that is a subformat of JFIF (to wit, a JFIF
|
|
file that contains an EXIF header as an APP1 marker).
|
|
<B>jpegtopnm</B>
|
|
|
|
handles EXIF.
|
|
<P>
|
|
JFIF files can have either 8 bits per sample or 12 bits per sample.
|
|
The 8 bit variety is by far the most common. There are two versions
|
|
of the IJG JPEG library. One reads only 8 bit files and the other
|
|
reads only 12 bit files. You must link the appropriate one of these
|
|
libraries with
|
|
<B>jpegtopnm</B>.
|
|
|
|
Ordinarily, this means the library is in your shared library search
|
|
path when you run
|
|
<B>jpegtopnm</B>.
|
|
|
|
<P>
|
|
<B>jpegtopnm</B>
|
|
|
|
generates output with either one byte or two bytes per sample depending on
|
|
whether the JFIF input has either 8 bits or 12 bits per sample. You can
|
|
use
|
|
<B>pnmdepth</B>
|
|
|
|
to reduce a two-byte-per-sample file to a one-byte-per-sample file if
|
|
you need to.
|
|
<P>
|
|
If the JFIF file uses the CMYK or YCCK color space, the input does not
|
|
actually contain enough information to know what color each pixel is.
|
|
To know what color a pixel is, one would have to know the properties of
|
|
the inks to which the color space refers.
|
|
<B>jpegtopnm</B>
|
|
|
|
interprets the colors using the common transformation which assumes
|
|
all the inks are simply subtractive and linear.
|
|
<P>
|
|
<P>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
The options are only for advanced users:
|
|
<DL COMPACT>
|
|
<DT id="1"><B>-dct int</B>
|
|
|
|
<DD>
|
|
Use integer DCT method (default).
|
|
<DT id="2"><B>-dct fast</B>
|
|
|
|
<DD>
|
|
Use fast integer DCT (less accurate).
|
|
<DT id="3"><B>-dct float</B>
|
|
|
|
<DD>
|
|
Use floating-point DCT method.
|
|
The float method is very slightly more accurate than the int method, but is
|
|
much slower unless your machine has very fast floating-point hardware. Also
|
|
note that results of the floating-point method may vary slightly across
|
|
machines, while the integer methods should give the same results everywhere.
|
|
The fast integer method is much less accurate than the other two.
|
|
<DT id="4"><B>-nosmooth</B>
|
|
|
|
<DD>
|
|
Use a faster, lower-quality upsampling routine.
|
|
<DT id="5"><B>-maxmemory</B><I> N</I>
|
|
|
|
<DD>
|
|
Set limit on the amount of memory
|
|
<B>jpegtopnm</B>
|
|
|
|
uses in processing large images. Value is in thousands of bytes, or
|
|
millions of bytes if "M" is suffixed to the number. For example,
|
|
<B>-maxmemory 4m</B>
|
|
|
|
selects 4000000 bytes. If
|
|
<B>jpegtopnm</B>
|
|
|
|
needs more space, it uses temporary files.
|
|
<DT id="6"><B>-adobe</B>
|
|
|
|
<DD>
|
|
<DT id="7"><B>-notadobe</B>
|
|
|
|
<DD>
|
|
There are two variations on the CMYK (and likewise YCCK) color space that
|
|
may be used in the JFIF input. In the normal one, a zero value for a color
|
|
components indicates absence of ink. In the other, a zero value means the
|
|
maximum ink coverage. The latter is used by Adobe Photoshop when it creates
|
|
a bare JFIF output file (but not when it creates JFIF output as part of
|
|
Encapsulated Postscript output).
|
|
<P>
|
|
These options tell
|
|
<B>jpegtopnm</B>
|
|
|
|
which version of the CMYK or YCCK color space the image uses. If you
|
|
specify neither,
|
|
<B>jpegtopnm</B>
|
|
|
|
tries to figure it out on its own. In the present version, it doesn't
|
|
try very hard at all: It just assumes the Photoshop version, since
|
|
Photoshop and its emulators seem to be the main source of CMYK and
|
|
YCCK images. But with experience of use, future versions might be
|
|
more sophisticated.
|
|
<P>
|
|
If the JFIF image does not indicate that it is CMYK or YCCK, these
|
|
options have no effect.
|
|
<P>
|
|
If you don't use the right one of these options, the symptom is output
|
|
that looks like a negative.
|
|
<P>
|
|
<DT id="8"><B>-dumpexif</B>
|
|
|
|
<DD>
|
|
Print the interpreted contents of any Exif header in the input file to the
|
|
Standard Error file. Similar to the program
|
|
<B>jhead</B>
|
|
|
|
(not part of the Netpbm package).
|
|
<DT id="9"><B>-exif=</B><I>filespec</I>
|
|
|
|
<DD>
|
|
Extract the contents of the EXIF header from the input image and write it
|
|
to the file
|
|
<I>filespec</I>.
|
|
|
|
<I>filespec </I>
|
|
|
|
=
|
|
<B>-</B>
|
|
|
|
means write it to Standard Output. In this case,
|
|
<B>jpegtopnm</B>
|
|
|
|
does not output the converted image at all.
|
|
<P>
|
|
<B>jpegtopnm</B>
|
|
|
|
writes the contents of the EXIF header byte-for-byte, starting with the
|
|
two byte length field (which length includes those two bytes).
|
|
<P>
|
|
You can use this file as input to
|
|
<B>ppmtojpeg</B>
|
|
|
|
to insert an identical EXIF header into a new JFIF image.
|
|
<P>
|
|
If there is no EXIF header,
|
|
<B>jpegtopnm</B>
|
|
|
|
writes two bytes of binary zero and nothing else.
|
|
<P>
|
|
An EXIF header takes the form of a JFIF APP1 marker. Only the first
|
|
such marker within the JFIF header counts.
|
|
<P>
|
|
<DT id="10"><B>-comments</B>
|
|
|
|
<DD>
|
|
Print any comments in the input file to the Standard Error file.
|
|
<DT id="11"><B>-verbose</B>
|
|
|
|
<DD>
|
|
Print details about the conversion to the Standard Error file.
|
|
<DT id="12"><B>-tracelevel</B><I> n</I>
|
|
|
|
<DD>
|
|
Turn on the JPEG library's trace messages to the Standard Error file.
|
|
A higher value of
|
|
<I>n</I>
|
|
|
|
gets more trace information.
|
|
<B>-verbose</B>
|
|
|
|
implies a trace level of at least 1.
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
<P>
|
|
|
|
This example converts the color JFIF file foo.jpg to a PPM file
|
|
named foo.ppm:
|
|
<DL COMPACT>
|
|
<DT id="13"><DD>
|
|
<B>jpegtopnm foo.jpg >foo.ppm</B>
|
|
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>HINTS</H2>
|
|
|
|
You can use
|
|
<B>ppmquant</B>
|
|
|
|
to color quantize the result, i.e. to reduce the number of distinct colors
|
|
in the image. In fact, you may have to if you want to convert the PPM
|
|
file to certain other formats.
|
|
<B>ppmdither</B>
|
|
|
|
Does a more sophisticated quantization.
|
|
<P>
|
|
|
|
Use
|
|
<B>pnmscale</B>
|
|
|
|
to change the dimensions of the resulting image.
|
|
<P>
|
|
|
|
Use
|
|
<B>ppmtopgm </B>
|
|
|
|
to convert a color JFIF file to a grayscale PGM file.
|
|
<P>
|
|
|
|
You can easily use these converters together. E.g.:
|
|
<DL COMPACT>
|
|
<DT id="14"><DD>
|
|
<B>jpegtopnm foo.jpg | ppmtopgm | pnmscale .25 </B>
|
|
|
|
<BR>
|
|
|
|
<B>>foo.pgm</B>
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
<B>-dct fast</B>
|
|
|
|
and/or
|
|
<B>-nosmooth</B>
|
|
|
|
gain speed at a small sacrifice in quality.
|
|
<P>
|
|
|
|
If you are fortunate enough to have very fast floating point hardware,
|
|
<B>-dct float</B> may be even faster than <B>-dct fast</B>. But
|
|
on most machines <B>-dct float</B> is slower than <B>-dct int</B>;
|
|
in this case it is not worth using, because its theoretical accuracy
|
|
advantage is too small to be significant in practice.
|
|
<P>
|
|
Another program,
|
|
<B>djpeg</B>,
|
|
|
|
is similar.
|
|
<B>djpeg</B>
|
|
|
|
is maintained by the Independent JPEG Group and packaged with the
|
|
JPEG library which
|
|
<B>jpegtopnm</B>
|
|
|
|
uses for all its JPEG work. Because of that, you may expect it to exploit
|
|
more current JPEG features. Also, since you have to have the library to
|
|
run
|
|
<B>jpegtopnm</B>,
|
|
|
|
but not vice versa,
|
|
<B>cjpeg</B>
|
|
|
|
may be more commonly available.
|
|
<P>
|
|
|
|
On the other hand,
|
|
<B>djpeg</B>
|
|
|
|
does not use the NetPBM libraries to generate its output, as all the NetPBM
|
|
tools such as
|
|
<B>jpegtopnm</B>
|
|
|
|
do. This means it is less likely to be consistent with all the other programs
|
|
that deal with the NetPBM formats. Also, the command syntax of
|
|
<B>jpegtopnm</B>
|
|
|
|
is consistent with that of the other Netpbm tools, unlike
|
|
<B>djpeg</B>.
|
|
|
|
<P>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>ENVIRONMENT</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="15"><B>JPEGMEM</B>
|
|
|
|
<DD>
|
|
If this environment variable is set, its value is the default memory limit.
|
|
The value is specified as described for the
|
|
<B>-maxmemory</B>
|
|
|
|
option. An explicit
|
|
<B>-maxmemory </B>
|
|
|
|
option overrides any
|
|
<B>JPEGMEM</B>.
|
|
|
|
</DL>
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+ppm">ppm</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+pgm">pgm</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ppmtojpeg">ppmtojpeg</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ppmquant">ppmquant</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmscale">pnmscale</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ppmtopgm">ppmtopgm</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ppmdither">ppmdither</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+pnmdepth">pnmdepth</A></B>(1),
|
|
|
|
<BR>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+djpeg">djpeg</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+cjpeg">cjpeg</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+jpegtran">jpegtran</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+rdjpgcom">rdjpgcom</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+wrjpgcom">wrjpgcom</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+jhead">jhead</A></B>(1)
|
|
|
|
<BR>
|
|
|
|
Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
|
|
Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
|
|
<P>
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>LIMITATIONS</H2>
|
|
|
|
Arithmetic coding is not supported for legal reasons.
|
|
<P>
|
|
|
|
The program could be much faster.
|
|
<P>
|
|
<A NAME="lbAK"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
<B>jpegtopnm</B>
|
|
|
|
and this man page were derived in large part from
|
|
<B>djpeg</B>,
|
|
|
|
by the Independent JPEG Group.
|
|
The program is otherwise by Bryan Henderson on March 19, 2000.
|
|
<P>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="16"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="17"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="18"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="19"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="20"><A HREF="#lbAF">EXAMPLES</A><DD>
|
|
<DT id="21"><A HREF="#lbAG">HINTS</A><DD>
|
|
<DT id="22"><A HREF="#lbAH">ENVIRONMENT</A><DD>
|
|
<DT id="23"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
<DT id="24"><A HREF="#lbAJ">LIMITATIONS</A><DD>
|
|
<DT id="25"><A HREF="#lbAK">AUTHOR</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:17 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|