1Jpegtopnm User Manual(0) Jpegtopnm User Manual(0)
2
3
4
6 jpegtopnm - convert JPEG/JFIF file to PPM or PGM image
7
8
10 jpegtopnm [-dct {int|fast|float}] [-nosmooth] [-maxmemory N]
11 [{-adobe|-notadobe}] [-comments] [-dumpexif] [-exif=filespec] [-multi‐
12 ple] [-repair] [-verbose] [-tracelevel N] [filename]
13
14 Minimum unique abbreviation of option is acceptable. You may use dou‐
15 ble hyphens instead of single hyphen to denote options. You may use
16 white space in place of the equals sign to separate an option name from
17 its value.
18
19
21 This program is part of Netpbm(1).
22
23 jpegtopnm converts JFIF images to PPM or PGM images.
24
25 By default, jpegtopnm expects the input stream to contain one JFIF
26 image and produces one PGM or PPM image as output. It fails if the
27 input stream is empty.
28
29 But with the -multiple option, jpegtopnm reads JFIF images sequentially
30 from the input stream and writes one PPM or PGM image to the output
31 stream for each JFIF input. If the input stream is empty, so is the
32 output.
33
34 The input stream is the filename you specify or, if you don't specify
35 filename, Standard Input. The output stream is Standard Output.
36
37 If a JFIF input image is of the grayscale variety, jpegtopnm generates
38 a PGM image. Otherwise, it generates a PPM image.
39
40 Before Netpbm 10.11 (October 2002), jpegtopnm did not have the multiple
41 image stream capability. From 10.11 through 10.22, Netpbm always
42 behaved as if you specified -multiple. Starting with Netpbm 10.23
43 (July 2004), Netpbm's default behavior went back to the pre-10.11
44 behavior and the new -multiple option selected the 10.12 behavior. The
45 reason for the reversion was that there were discovered in the world
46 files that contain JFIF images followed by something other than another
47 JFIF image. The producers of these files expect them to work with any
48 JFIF interpreter because most JFIF interpreters just stop reading the
49 file after the first JFIF image.
50
51 jpegtopnm uses the Independent JPEG Group's JPEG library to interpret
52 the input file. See http://www.ijg.org ⟨http://www.ijg.org⟩ for
53 information on the library.
54
55 "JFIF" is the correct name for the image format commonly known as
56 "JPEG." Strictly speaking, JPEG is a method of compression. The image
57 format using JPEG compression that is by far the most common is JFIF.
58 There is also a subformat of TIFF that uses JPEG compression.
59
60 EXIF is an image format that is a subformat of JFIF (to wit, a JFIF
61 file that contains an EXIF header as an APP1 marker). jpegtopnm han‐
62 dles EXIF.
63
64 JFIF files can have either 8 bits per sample or 12 bits per sample.
65 The 8 bit variety is by far the most common. There are two versions of
66 the IJG JPEG library. One reads only 8 bit files and the other reads
67 only 12 bit files. You must link the appropriate one of these
68 libraries with jpegtopnm. Ordinarily, this means the library is in
69 your shared library search path when you run jpegtopnm.
70
71 jpegtopnm generates output with either one byte or two bytes per sample
72 depending on whether the JFIF input has either 8 bits or 12 bits per
73 sample. You can use pamdepth to reduce a two-byte-per-sample file to a
74 one-byte-per-sample file if you need to.
75
76 If the JFIF file uses the CMYK or YCCK color space, the input does not
77 actually contain enough information to know what color each pixel is.
78 To know what color a pixel is, one would have to know the properties of
79 the inks to which the color space refers. jpegtopnm interprets the
80 colors using the common transformation which assumes all the inks are
81 simply subtractive and linear.
82
83 See the jpegtopnm manual(1) for information on how images lose quality
84 when you convert to and from JFIF.
85
86
88 In addition to the options common to all programs based on libnetpbm
89 (most notably -quiet, see
90 Common Options ⟨index.html#commonoptions⟩ ), jpegtopnm recognizes the
91 following command line options:
92
93 The options are only for advanced users.
94
95
96
97 -dct int
98 Use integer DCT method (default).
99
100
101 -dct fast
102 Use fast integer DCT (less accurate).
103
104
105 -dct float
106 Use floating-point DCT method. The float method is very
107 slightly more accurate than the int method, but is much slower
108 unless your machine has very fast floating-point hardware. Also
109 note that results of the floating-point method may vary slightly
110 across machines, while the integer methods should give the same
111 results everywhere. The fast integer method is much less accu‐
112 rate than the other two.
113
114
115 -nosmooth
116 Use a faster, lower-quality upsampling routine.
117
118 -maxmemory N
119 Set limit on the amount of memory jpegtopnm uses in processing
120 large images. Value is in thousands of bytes, or millions of
121 bytes if "M" is suffixed to the number. For example, -maxmemory
122 4m selects 4000000 bytes. If jpegtopnm needs more space, it
123 uses temporary files.
124
125
126 -adobe
127
128 -notadobe
129 There are two variations on the CMYK (and likewise YCCK) color
130 space that may be used in the JFIF input. In the normal one, a
131 zero value for a color components indicates absence of ink. In
132 the other, a zero value means the maximum ink coverage. The
133 latter is used by Adobe Photoshop when it creates a bare JFIF
134 output file (but not when it creates JFIF output as part of
135 Encapsulated Postscript output).
136
137 These options tell jpegtopnm which version of the CMYK or YCCK
138 color space the image uses. If you specify neither, jpegtopnm
139 tries to figure it out on its own. In the present version, it
140 doesn't try very hard at all: It just assumes the Photoshop ver‐
141 sion, since Photoshop and its emulators seem to be the main
142 source of CMYK and YCCK images. But with experience of use,
143 future versions might be more sophisticated.
144
145 If the JFIF image does not indicate that it is CMYK or YCCK,
146 these options have no effect.
147
148 If you don't use the right one of these options, the symptom is
149 output that looks like a negative.
150
151
152 -dumpexif
153 Print the interpreted contents of any Exif header in the input
154 file to the Standard Error file. Similar to the program jhead
155 (not part of the Netpbm package).
156
157 This option was added in Netpbm 9.19 (September 2001).
158
159
160 -exif=filespec
161 Extract the contents of the EXIF header from the input image and
162 write it to the file filespec. filespec=- means write it to
163 Standard Output. When you write the EXIF header to Standard
164 Output, jpegtopnm does not output the converted image (which is
165 what normally would go to Standard Output) at all.
166
167 jpegtopnm writes the contents of the EXIF header byte-for-byte,
168 starting with the two byte length field (which length includes
169 those two bytes).
170
171 You can use this file as input to pnmtojpeg to insert an identi‐
172 cal EXIF header into a new JFIF image.
173
174 If there is no EXIF header, jpegtopnm writes two bytes of binary
175 zero and nothing else.
176
177 An EXIF header takes the form of a JFIF APP1 marker. Only the
178 first such marker within the JFIF header counts.
179
180 This option was added in Netpbm 9.19 (September 2001).
181
182
183 -multiple
184 Read multiple JFIF images sequentially from the input stream.
185 See Description section ⟨#description⟩ for details.
186
187 This option was new in Netpbm 10.23 (July 2004).
188
189
190 -repair
191 If the JFIF input is invalid, try to salvage whatever informa‐
192 tion is there and produce a valid PNM image as output.
193
194 Without this option, some invalid input causes jpegtopnm to
195 fail, and what output it produces is undefined. With -repair
196 such invalid input causes jpegtopnm to succeed instead.
197
198 But note that there are some forms of invalid input that always
199 cause jpegtopnm to fail and others that always cause it to sal‐
200 vage image information and succeed.
201
202 One particular case where -repair makes a difference is the com‐
203 mon case that the file is truncated somewhere after the JFIF
204 header. Without -repair, that always causes a failure; with
205 -repair it always causes success. Because the image information
206 is laid out generally top to bottom in the JFIF stream, the
207 image jpegtopnm produces in this case has the proper image con‐
208 tents at the top, but the bottom is padded with gray.
209
210 This option was new in Netpbm 10.38.0 (March 2007). Before
211 that, jpegtopnm always fails in the cases in question.
212
213
214
215 -comments
216 Print any comments in the input file to the Standard Error file.
217
218
219 -verbose
220 Print details about the conversion to the Standard Error file.
221
222
223 -tracelevel n
224 Turn on the JPEG library's trace messages to the Standard Error
225 file. A higher value of n gets more trace information. -ver‐
226 bose implies a trace level of at least 1.
227
228
229
230
232 This example converts the color JFIF file foo.jpg to a PPM file named
233 foo.ppm:
234
235 jpegtopnm foo.jpg >foo.ppm
236
237
239 You can use pnmquant to color quantize the result, i.e. to reduce the
240 number of distinct colors in the image. In fact, you may have to if
241 you want to convert the PPM file to certain other formats. ppmdither
242 Does a more sophisticated quantization.
243
244 Use pamscale to change the dimensions of the resulting image.
245
246 Use ppmtopgm to convert a color JFIF file to a grayscale PGM file.
247
248 You can easily use these converters together. E.g.:
249
250 jpegtopnm foo.jpg | ppmtopgm | pamscale .25 >foo.pgm
251
252 -dct fast and/or -nosmooth gain speed at a small sacrifice in quality.
253
254 If you are fortunate enough to have very fast floating point hardware,
255 -dct float may be even faster than -dct fast. But on most machines
256 -dct float is slower than -dct int; in this case it is not worth using,
257 because its theoretical accuracy advantage is too small to be signifi‐
258 cant in practice.
259
260 Another program, djpeg, is similar. djpeg is maintained by the Inde‐
261 pendent JPEG Group and packaged with the JPEG library which jpegtopnm
262 uses for all its JPEG work. Because of that, you may expect it to
263 exploit more current JPEG features. Also, since you have to have the
264 library to run jpegtopnm, but not vice versa, cjpeg may be more com‐
265 monly available.
266
267 On the other hand, djpeg does not use the NetPBM libraries to generate
268 its output, as all the NetPBM tools such as jpegtopnm do. This means
269 it is less likely to be consistent with all the other programs that
270 deal with the NetPBM formats. Also, the command syntax of jpegtopnm is
271 consistent with that of the other Netpbm tools, unlike djpeg.
272
273
275 JPEGMEM
276 If this environment variable is set, its value is the default
277 memory limit. The value is specified as described for the
278 -maxmemory option. An explicit -maxmemory option overrides any
279 JPEGMEM.
280
281
282
283
285 ppm(1), pgm(1), pnmtojpeg(1), pnmquant(1), pamscale(1), ppmtopgm(1),
286 ppmdither(1), pamdepth(1),
287
288 djpeg man page, cjpeg man page, jpegtran man page, rdjpgcom man page,
289 wrjpgcom man page, jhead man page
290
291 Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
292 Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
293
294
296 jpegtopnm and this manual were derived in large part from djpeg, by the
297 Independent JPEG Group. The program is otherwise by Bryan Henderson on
298 March 19, 2000.
299
301 This manual page was generated by the Netpbm tool 'makeman' from HTML
302 source. The master documentation is at
303
304 http://netpbm.sourceforge.net/doc/jpegtopnm.html
305
306netpbm documentation 13 October 2002 Jpegtopnm User Manual(0)