\ .\" This man page was generated by the Netpbm tool 'makeman' from HTML source. .\" Do not hand-hack it! If you have bug fixes or improvements, please find .\" the corresponding HTML page on the Netpbm website, generate a patch .\" against that, and send it to the Netpbm maintainer. .TH "Jpegtopnm User Manual" 0 "13 October 2002" "netpbm documentation" .SH NAME jpegtopnm - convert JPEG/JFIF file to PPM or PGM image .UN synopsis .SH SYNOPSIS \fBjpegtopnm\fP [\fB-dct\fP {\fBint\fP|\fBfast\fP|\fBfloat\fP}] [\fB-nosmooth\fP] [\fB-maxmemory\fP \fIN\fP] [{\fB-adobe\fP|\fB-notadobe\fP}] [\fB-comments\fP] [\fB-dumpexif\fP] [\fB-exif=\fP\fIfilespec\fP] [\fB-multiple\fP] [\fB-repair\fP] [\fB-verbose\fP] [\fB-tracelevel\fP \fIN\fP] [\fIfilename\fP] .PP 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. .UN description .SH DESCRIPTION .PP This program is part of .BR "Netpbm" (1)\c \&. .PP \fBjpegtopnm\fP converts JFIF images to PPM or PGM images. .PP By default, \fBjpegtopnm\fP expects the input stream to contain one JFIF image and produces one PGM or PPM image as output. It fails if the input stream is empty. .PP But with the \fB-multiple\fP option, \fBjpegtopnm\fP reads JFIF images sequentially from the input stream and writes one PPM or PGM image to the output stream for each JFIF input. If the input stream is empty, so is the output. .PP The input stream is the \fIfilename\fP you specify or, if you don't specify \fIfilename\fP, Standard Input. The output stream is Standard Output. .PP If a JFIF input image is of the grayscale variety, \fBjpegtopnm\fP generates a PGM image. Otherwise, it generates a PPM image. .PP Before Netpbm 10.11 (October 2002), \fBjpegtopnm\fP did not have the multiple image stream capability. From 10.11 through 10.22, Netpbm always behaved as if you specified \fB-multiple\fP. Starting with Netpbm 10.23 (July 2004), Netpbm's default behavior went back to the pre-10.11 behavior and the new \fB-multiple\fP option selected the 10.12 behavior. The reason for the reversion was that there were discovered in the world files that contain JFIF images followed by something other than another JFIF image. The producers of these files expect them to work with any JFIF interpreter because most JFIF interpreters just stop reading the file after the first JFIF image. .PP \fBjpegtopnm\fP uses the Independent JPEG Group's JPEG library to interpret the input file. See \fB .UR http://www.ijg.org http://www.ijg.org .UE \& \fP for information on the library. .PP "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. .PP 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). \fBjpegtopnm\fP handles EXIF. .PP 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 \fBjpegtopnm\fP. Ordinarily, this means the library is in your shared library search path when you run \fBjpegtopnm\fP. .PP \fBjpegtopnm\fP 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 \fBpamdepth\fP to reduce a two-byte-per-sample file to a one-byte-per-sample file if you need to. .PP 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. \fBjpegtopnm\fP interprets the colors using the common transformation which assumes all the inks are simply subtractive and linear. .PP See the .BR "\fBjpegtopnm\fP manual" (1)\c \& for information on how images lose quality when you convert to and from JFIF. .UN options .SH OPTIONS The options are only for advanced users: .TP \fB-dct int\fP Use integer DCT method (default). .TP \fB-dct fast\fP Use fast integer DCT (less accurate). .TP \fB-dct float\fP 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. .TP \fB-nosmooth\fP Use a faster, lower-quality upsampling routine. .TP \fB-maxmemory\fP\fI N\fP Set limit on the amount of memory \fBjpegtopnm\fP uses in processing large images. Value is in thousands of bytes, or millions of bytes if "M" is suffixed to the number. For example, \fB-maxmemory 4m\fP selects 4000000 bytes. If \fBjpegtopnm\fP needs more space, it uses temporary files. .TP \fB-adobe\fP .TP \fB-notadobe\fP 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). .sp These options tell \fBjpegtopnm\fP which version of the CMYK or YCCK color space the image uses. If you specify neither, \fBjpegtopnm\fP 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. .sp If the JFIF image does not indicate that it is CMYK or YCCK, these options have no effect. .sp If you don't use the right one of these options, the symptom is output that looks like a negative. .TP \fB-dumpexif\fP Print the interpreted contents of any Exif header in the input file to the Standard Error file. Similar to the program \fBjhead\fP (not part of the Netpbm package). .sp This option was added in Netpbm 9.19 (September 2001). .TP \fB-exif=\fP\fIfilespec\fP Extract the contents of the EXIF header from the input image and write it to the file \fIfilespec\fP. \fIfilespec\fP=\fB-\fP means write it to Standard Output. When you write the EXIF header to Standard Output, \fBjpegtopnm\fP does not output the converted image (which is what normally would go to Standard Output) at all. .sp \fBjpegtopnm\fP writes the contents of the EXIF header byte-for-byte, starting with the two byte length field (which length includes those two bytes). .sp You can use this file as input to \fBpnmtojpeg\fP to insert an identical EXIF header into a new JFIF image. .sp If there is no EXIF header, \fBjpegtopnm\fP writes two bytes of binary zero and nothing else. .sp An EXIF header takes the form of a JFIF APP1 marker. Only the first such marker within the JFIF header counts. .sp This option was added in Netpbm 9.19 (September 2001). .TP \fB-multiple\fP Read multiple JFIF images sequentially from the input stream. See .UR #description Description section .UE \& for details. .sp This option was new in Netpbm 10.23 (July 2004). .TP \fB-repair\fP If the JFIF input is invalid, try to salvage whatever information is there and produce a valid PNM image as output. .sp Without this option, some invalid input causes \fBjpegtopnm\fP to fail, and what output it produces is undefined. With \fB-repair\fP such invalid input causes \fBjpegtopnm\fP to succeed instead. .sp But note that there are some forms of invalid input that always cause \fBjpegtopnm\fP to fail and others that always cause it to salvage image information and succeed. .sp One particular case where \fB-repair\fP makes a difference is the common case that the file is truncated somewhere after the JFIF header. Without \fB-repair\fP, that always causes a failure; with \fB-repair\fP it always causes success. Because the image information is laid out generally top to bottom in the JFIF stream, the image \fBjpegtopnm\fP produces in this case has the proper image contents at the top, but the bottom is padded with gray. .sp This option was new in Netpbm 10.38.0 (March 2007). Before that, \fBjpegtopnm\fP always fails in the cases in question. .TP \fB-comments\fP Print any comments in the input file to the Standard Error file. .TP \fB-verbose\fP Print details about the conversion to the Standard Error file. .TP \fB-tracelevel\fP\fI n\fP Turn on the JPEG library's trace messages to the Standard Error file. A higher value of \fIn\fP gets more trace information. \fB-verbose\fP implies a trace level of at least 1. .UN examples .SH EXAMPLES .PP This example converts the color JFIF file foo.jpg to a PPM file named foo.ppm: .nf jpegtopnm foo.jpg >foo.ppm .fi .UN hints .SH HINTS You can use \fBpnmquant\fP 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. \fBppmdither\fP Does a more sophisticated quantization. .PP Use \fBpamscale\fP to change the dimensions of the resulting image. .PP Use \fBppmtopgm \fP to convert a color JFIF file to a grayscale PGM file. .PP You can easily use these converters together. E.g.: .nf jpegtopnm foo.jpg | ppmtopgm | pamscale .25 >foo.pgm .fi .PP \fB-dct fast\fP and/or \fB-nosmooth\fP gain speed at a small sacrifice in quality. .PP If you are fortunate enough to have very fast floating point hardware, \fB-dct float\fP may be even faster than \fB-dct fast\fP. But on most machines \fB-dct float\fP is slower than \fB-dct int\fP; in this case it is not worth using, because its theoretical accuracy advantage is too small to be significant in practice. .PP Another program, \fBdjpeg\fP, is similar. \fBdjpeg\fP is maintained by the Independent JPEG Group and packaged with the JPEG library which \fBjpegtopnm\fP 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 \fBjpegtopnm\fP, but not vice versa, \fBcjpeg\fP may be more commonly available. .PP On the other hand, \fBdjpeg\fP does not use the NetPBM libraries to generate its output, as all the NetPBM tools such as \fBjpegtopnm\fP 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 \fBjpegtopnm\fP is consistent with that of the other Netpbm tools, unlike \fBdjpeg\fP. .UN environment .SH ENVIRONMENT .TP \fBJPEGMEM\fP If this environment variable is set, its value is the default memory limit. The value is specified as described for the \fB-maxmemory\fP option. An explicit \fB-maxmemory \fP option overrides any \fBJPEGMEM\fP. .UN seealso .SH SEE ALSO .PP .BR "ppm" (5)\c \&, .BR "pgm" (5)\c \&, .BR "pnmtojpeg" (1)\c \&, .BR "pnmquant" (1)\c \&, .BR "pamscale" (1)\c \&, .BR "ppmtopgm" (1)\c \&, .BR "ppmdither" (1)\c \&, .BR "pamdepth" (1)\c \&, .PP \fBdjpeg\fP man page, \fBcjpeg\fP man page, \fBjpegtran\fP man page, \fBrdjpgcom\fP man page, \fBwrjpgcom\fP man page, \fBjhead\fP man page .PP Wallace, Gregory K. "The JPEG Still Picture Compression Standard", Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44. .UN author .SH AUTHOR .PP \fBjpegtopnm\fP and this manual were derived in large part from \fBdjpeg\fP, by the Independent JPEG Group. The program is otherwise by Bryan Henderson on March 19, 2000. .SH DOCUMENT SOURCE This manual page was generated by the Netpbm tool 'makeman' from HTML source. The master documentation is at .IP .B http://netpbm.sourceforge.net/doc/jpegtopnm.html .PP