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 im‐
26 age and produces one PGM or PPM image as output. It fails if the input
27 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 be‐
42 haved as if you specified -multiple. Starting with Netpbm 10.23 (July
43 2004), Netpbm's default behavior went back to the pre-10.11 behavior
44 and the new -multiple option selected the 10.12 behavior. The reason
45 for the reversion was that there were discovered in the world files
46 that contain JFIF images followed by something other than another JFIF
47 image. The producers of these files expect them to work with any JFIF
48 interpreter because most JFIF interpreters just stop reading the file
49 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 in‐
53 formation 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 li‐
68 braries with jpegtopnm. Ordinarily, this means the library is in your
69 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 En‐
135 capsulated 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, fu‐
143 ture 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 im‐
207 age 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
238
240 You can use pnmquant to color quantize the result, i.e. to reduce the
241 number of distinct colors in the image. In fact, you may have to if
242 you want to convert the PPM file to certain other formats. ppmdither
243 Does a more sophisticated quantization.
244
245 Use pamscale to change the dimensions of the resulting image.
246
247 Use ppmtopgm to convert a color JFIF file to a grayscale PGM file.
248
249 You can easily use these converters together. E.g.:
250
251 jpegtopnm foo.jpg | ppmtopgm | pamscale .25 >foo.pgm
252
253
254 -dct fast and/or -nosmooth gain speed at a small sacrifice in quality.
255
256 If you are fortunate enough to have very fast floating point hardware,
257 -dct float may be even faster than -dct fast. But on most machines
258 -dct float is slower than -dct int; in this case it is not worth using,
259 because its theoretical accuracy advantage is too small to be signifi‐
260 cant in practice.
261
262 Another program, djpeg, is similar. djpeg is maintained by the Inde‐
263 pendent JPEG Group and packaged with the JPEG library which jpegtopnm
264 uses for all its JPEG work. Because of that, you may expect it to ex‐
265 ploit more current JPEG features. Also, since you have to have the li‐
266 brary to run jpegtopnm, but not vice versa, cjpeg may be more commonly
267 available.
268
269 On the other hand, djpeg does not use the NetPBM libraries to generate
270 its output, as all the NetPBM tools such as jpegtopnm do. This means
271 it is less likely to be consistent with all the other programs that
272 deal with the NetPBM formats. Also, the command syntax of jpegtopnm is
273 consistent with that of the other Netpbm tools, unlike djpeg.
274
275
277 JPEGMEM
278 If this environment variable is set, its value is the default
279 memory limit. The value is specified as described for the
280 -maxmemory option. An explicit -maxmemory option overrides any
281 JPEGMEM.
282
283
284
285
287 ppm(1), pgm(1), pnmtojpeg(1), pnmquant(1), pamscale(1), ppmtopgm(1),
288 ppmdither(1), pamdepth(1),
289
290 djpeg man page, cjpeg man page, jpegtran man page, rdjpgcom man page,
291 wrjpgcom man page, jhead man page
292
293 Wallace, Gregory K. "The JPEG Still Picture Compression Standard",
294 Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
295
296
298 jpegtopnm and this manual were derived in large part from djpeg, by the
299 Independent JPEG Group. The program is otherwise by Bryan Henderson on
300 March 19, 2000.
301
303 This manual page was generated by the Netpbm tool 'makeman' from HTML
304 source. The master documentation is at
305
306 http://netpbm.sourceforge.net/doc/jpegtopnm.html
307
308netpbm documentation 13 October 2002 Jpegtopnm User Manual(0)