1Jpegtopnm User Manual(0)                              Jpegtopnm User Manual(0)
2
3
4

NAME

6       jpegtopnm - convert JPEG/JFIF file to PPM or PGM image
7
8

SYNOPSIS

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

DESCRIPTION

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.orghttp://www.ijg.orgfor
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 jpegtopnmmanual(1) for information on how images  lose  quality
84       when you convert to and from JFIF.
85
86

OPTIONS

88       The options are only for advanced users:
89
90
91       -dct int
92              Use integer DCT method (default).
93
94
95       -dct fast
96              Use fast integer DCT (less accurate).
97
98
99       -dct float
100              Use  floating-point  DCT  method.   The  float  method  is  very
101              slightly more accurate than the int method, but is  much  slower
102              unless your machine has very fast floating-point hardware.  Also
103              note that results of the floating-point method may vary slightly
104              across  machines, while the integer methods should give the same
105              results everywhere.  The fast integer method is much less  accu‐
106              rate than the other two.
107
108
109       -nosmooth
110              Use a faster, lower-quality upsampling routine.
111
112       -maxmemory N
113              Set  limit  on the amount of memory jpegtopnm uses in processing
114              large images.  Value is in thousands of bytes,  or  millions  of
115              bytes if 'M' is suffixed to the number.  For example, -maxmemory
116              4m selects 4000000 bytes.  If jpegtopnm  needs  more  space,  it
117              uses temporary files.
118
119
120       -adobe
121
122       -notadobe
123              There  are  two variations on the CMYK (and likewise YCCK) color
124              space that may be used in the JFIF input.  In the normal one,  a
125              zero  value for a color components indicates absence of ink.  In
126              the other, a zero value means the  maximum  ink  coverage.   The
127              latter  is  used  by Adobe Photoshop when it creates a bare JFIF
128              output file (but not when it creates  JFIF  output  as  part  of
129              Encapsulated Postscript output).
130
131              These  options  tell jpegtopnm which version of the CMYK or YCCK
132              color space the image uses.  If you specify  neither,  jpegtopnm
133              tries  to  figure it out on its own.  In the present version, it
134              doesn't try very hard at all: It just assumes the Photoshop ver‐
135              sion,  since  Photoshop  and  its  emulators seem to be the main
136              source of CMYK and YCCK images.  But  with  experience  of  use,
137              future versions might be more sophisticated.
138
139              If  the  JFIF  image  does not indicate that it is CMYK or YCCK,
140              these options have no effect.
141
142              If you don't use the right one of these options, the symptom  is
143              output that looks like a negative.
144
145
146       -dumpexif
147              Print  the  interpreted contents of any Exif header in the input
148              file to the Standard Error file.  Similar to the  program  jhead
149              (not part of the Netpbm package).
150
151              This option was added in Netpbm 9.19 (September 2001).
152
153
154       -exif=filespec
155              Extract the contents of the EXIF header from the input image and
156              write it to the file filespec.  filespec=-  means  write  it  to
157              Standard  Output.   When  you  write the EXIF header to Standard
158              Output, jpegtopnm does not output the converted image (which  is
159              what normally would go to Standard Output) at all.
160
161              jpegtopnm  writes the contents of the EXIF header byte-for-byte,
162              starting with the two byte length field (which  length  includes
163              those two bytes).
164
165              You can use this file as input to pnmtojpeg to insert an identi‐
166              cal EXIF header into a new JFIF image.
167
168              If there is no EXIF header, jpegtopnm writes two bytes of binary
169              zero and nothing else.
170
171              An  EXIF  header takes the form of a JFIF APP1 marker.  Only the
172              first such marker within the JFIF header counts.
173
174              This option was added in Netpbm 9.19 (September 2001).
175
176
177       -multiple
178              Read multiple JFIF images sequentially from  the  input  stream.
179              See Description section ⟨#description⟩  for details.
180
181              This option was new in Netpbm 10.23 (July 2004).
182
183
184       -repair
185              If  the  JFIF input is invalid, try to salvage whatever informa‐
186              tion is there and produce a valid PNM image as output.
187
188              Without this option, some  invalid  input  causes  jpegtopnm  to
189              fail,  and  what  output it produces is undefined.  With -repair
190              such invalid input causes jpegtopnm to succeed instead.
191
192              But note that there are some forms of invalid input that  always
193              cause  jpegtopnm  to fail and other than always cause it to sal‐
194              vage image information and succeed.
195
196              One particular case where -repair makes a difference is the com‐
197              mon  case  that  the  file is truncated somewhere after the JFIF
198              header.  Without -repair, that always  causes  a  failure;  with
199              -repair it always causes success.  Because the image information
200              is laid out generally top to bottom  in  the  JFIF  stream,  the
201              image  jpegtopnm produces in this case has the proper image con‐
202              tents at the top, but the bottom is padded with gray.
203
204              This option was new in  Netpbm  10.38.0  (March  2007).   Before
205              that, jpegtopnm always fails in the cases in question.
206
207
208
209       -comments
210              Print any comments in the input file to the Standard Error file.
211
212
213       -verbose
214              Print details about the conversion to the Standard Error file.
215
216
217       -tracelevel n
218              Turn  on the JPEG library's trace messages to the Standard Error
219              file.  A higher value of n gets more trace  information.   -ver‐
220              bose implies a trace level of at least 1.
221
222
223
224

EXAMPLES

226       This  example  converts the color JFIF file foo.jpg to a PPM file named
227       foo.ppm:
228
229           jpegtopnm foo.jpg >foo.ppm
230
231

HINTS

233       You can use pnmquant to color quantize the result, i.e. to  reduce  the
234       number  of  distinct  colors in the image.  In fact, you may have to if
235       you want to convert the PPM file to certain other  formats.   ppmdither
236       Does a more sophisticated quantization.
237
238       Use pamscale to change the dimensions of the resulting image.
239
240       Use ppmtopgm  to convert a color JFIF file to a grayscale PGM file.
241
242       You can easily use these converters together.  E.g.:
243
244           jpegtopnm foo.jpg | ppmtopgm | pamscale .25 >foo.pgm
245
246       -dct fast and/or -nosmooth gain speed at a small sacrifice in quality.
247
248       If  you are fortunate enough to have very fast floating point hardware,
249       -dct float may be even faster than -dct fast.   But  on  most  machines
250       -dct float is slower than -dct int; in this case it is not worth using,
251       because its theoretical accuracy advantage is too small to be  signifi‐
252       cant in practice.
253
254       Another  program,  djpeg, is similar.  djpeg is maintained by the Inde‐
255       pendent JPEG Group and packaged with the JPEG library  which  jpegtopnm
256       uses  for  all  its  JPEG  work.  Because of that, you may expect it to
257       exploit more current JPEG features.  Also, since you have to  have  the
258       library  to  run  jpegtopnm, but not vice versa, cjpeg may be more com‐
259       monly available.
260
261       On the other hand, djpeg does not use the NetPBM libraries to  generate
262       its  output,  as all the NetPBM tools such as jpegtopnm do.  This means
263       it is less likely to be consistent with all  the  other  programs  that
264       deal with the NetPBM formats.  Also, the command syntax of jpegtopnm is
265       consistent with that of the other Netpbm tools, unlike djpeg.
266
267

ENVIRONMENT

269       JPEGMEM
270              If this environment variable is set, its value  is  the  default
271              memory  limit.   The  value  is  specified  as described for the
272              -maxmemory option.  An explicit -maxmemory  option overrides any
273              JPEGMEM.
274
275
276
277

SEE ALSO

279       ppm(1),  pgm(1),  pnmtojpeg(1),  pnmquant(1), pamscale(1), ppmtopgm(1),
280       ppmdither(1), pamdepth(1),
281
282       djpeg man page, cjpeg man page, jpegtran man page, rdjpgcom  man  page,
283       wrjpgcom man page, jhead man page
284
285       Wallace,  Gregory  K.   'The  JPEG Still Picture Compression Standard',
286       Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
287
288

AUTHOR

290       jpegtopnm and this manual were derived in large part from djpeg, by the
291       Independent JPEG Group.  The program is otherwise by Bryan Henderson on
292       March 19, 2000.
293
294
295
296netpbm documentation            13 October 2002       Jpegtopnm User Manual(0)
Impressum