JPEGTOPNM

Section: User Commands (1)
Updated: 19 March 2000
Index Return to Main Contents
 

NAME

jpegtopnm - convert JPEG/JFIF file to portable pixmap or graymap  

SYNOPSIS

jpegtopnm [ options ] [ filename ]

 

DESCRIPTION

jpegtopnm converts the named JPEG/JFIF file, or the standard input if no file is named to a PPM or PGM image file on the standard output. If the JPEG file is of the grayscale variety, jpegtopnm generates a PGM (Portable Graymap) file. Otherwise, it generates a PPM (Portable Pixmap) file.

jpegtopnm uses the Independent JPEG Group's JPEG library to interpret the input file. See http://www.ijg.org for information on the library.

JPEG 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 jpegtopnm. Ordinarily, this means the library is in your shared library search path when you run jpegtopnm.

jpegtopnm generates output with either one byte or two bytes per sample depending on whether the JPEG input has either 8 bits or 12 bits per sample. You can use pnmdepth to reduce a two-byte-per-sample file to a one-byte-per-sample file if you need to.

 

OPTIONS

The options are only for advanced users:
--dct int
Use integer DCT method (default).
--dct fast
Use fast integer DCT (less accurate).
--dct float
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.
--nosmooth
Use a faster, lower-quality upsampling routine.
--maxmemory N
Set limit on the amount of memory jpegtopnm uses in processing large images. Value is in thousands of bytes, or millions of bytes if "M" is suffixed to the number. For example, --maxmemory 4m selects 4000000 bytes. If jpegtopnm needs more space, it uses temporary files.
--verbose
Print details about the conversion to the Standard Error file.
--tracelevel n
Turn on the JPEG library's trace messages to the Standard Error file. A higher value of n gets more trace information. --verbose implies a trace level of at least 1.

 

EXAMPLES

This example converts the color JPEG/JFIF file foo.jpg to a PPM file named foo.ppm:

jpegtopnm foo.jpg >foo.ppm

 

HINTS

You can use ppmquant 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. ppmdither Does a more sophisticated quantization.

Use pnmscale to change the dimensions of the resulting image.

Use ppmtopgm to convert a color JPEG file to a grayscale PGM file.

You can easily use these converters together. E.g.:

jpegtopnm foo.jpg | ppmtopgm | pnmscale .25
>foo.pgm

--dct fast and/or --nosmooth gain speed at a small sacrifice in quality.

If you are fortunate enough to have very fast floating point hardware, --dct float may be even faster than --dct fast. But on most machines --dct float is slower than --dct int; in this case it is not worth using, because its theoretical accuracy advantage is too small to be significant in practice.

Another program, djpeg, is similar. djpeg is maintained by the Independent JPEG Group and packaged with the JPEG library which jpegtopnm 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 jpegtopnm, but not vice versa, cjpeg may be more commonly available.

On the other hand, djpeg does not use the NetPBM libraries to generate its output, as all the NetPBM tools such as jpegtopnm 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 jpegtopnm is consistent with that of the other Netpbm tools, unlike djpeg.

 

ENVIRONMENT

JPEGMEM
If this environment variable is set, its value is the default memory limit. The value is specified as described for the --maxmemory option. An explicit --maxmemory option overrides any JPEGMEM.
 

SEE ALSO

ppm(5), pgm(5), ppmtojpeg(1), ppmquant(1), pnmscale(1), ppmtopgm(1), ppmdither(1), pnmdepth(1),
djpeg(1), cjpeg(1), jpegtran(1), rdjpgcom(1), wrjpgcom(1)
Wallace, Gregory K. "The JPEG Still Picture Compression Standard", Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.

 

LIMITATIONS

Arithmetic coding is not supported for legal reasons.

The program could be much faster.

 

AUTHOR

jpegtopnm and this man page were derived in large part from djpeg, by the Independent JPEG Group. The program is otherwise by Bryan Henderson on March 19, 2000.


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLES
HINTS
ENVIRONMENT
SEE ALSO
LIMITATIONS
AUTHOR

This document was created by man2html, using the manual pages.
Time: 16:15:23 GMT, July 31, 2024