~ubuntu-branches/ubuntu/jaunty/netpbm-free/jaunty

« back to all changes in this revision

Viewing changes to pnm/jpegtopnm.1

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2004-07-29 20:25:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040729202546-5x43bcfsdlt7dspl
Tags: upstream-10.0
ImportĀ upstreamĀ versionĀ 10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.TH JPEGTOPNM 1 "19 March 2000"
 
2
.SH NAME
 
3
jpegtopnm \- convert JPEG/JFIF file to portable pixmap or graymap
 
4
.SH SYNOPSIS
 
5
.B jpegtopnm
 
6
.RB [ -dct 
 
7
.RB { int | fast | float "}]"
 
8
.RB [ -nosmooth ]
 
9
.RB [ -maxmemory 
 
10
.IR N ]
 
11
.RB [{ -adobe | -notadobe }]
 
12
.RB [ -comments ]
 
13
.RB [ -dumpexif ]
 
14
.RB [ -exif=\fIfilespec ]
 
15
.RB [ -verbose ]
 
16
.RB [ -tracelevel
 
17
.IR N ]
 
18
[
 
19
.I filename
 
20
]
 
21
 
 
22
All options may be abbreviated to their shortest unique prefix.
 
23
 
 
24
.SH DESCRIPTION
 
25
.LP
 
26
.B jpegtopnm
 
27
converts the named JFIF file, or the standard input if no file is
 
28
named to a PPM or PGM image file on the standard output.  If the JFIF
 
29
file is of the grayscale variety, 
 
30
.B jpegtopnm
 
31
generates a PGM (Portable Graymap) file.  Otherwise, it generates a
 
32
PPM (Portable Pixmap) file.
 
33
.PP
 
34
.B jpegtopnm
 
35
uses the Independent JPEG Group's JPEG library to interpret the input file.
 
36
See 
 
37
.B http://www.ijg.org 
 
38
for information on the library.
 
39
 
 
40
"JFIF" is the correct name for the image format commonly known as "JPEG."
 
41
Strictly speaking, JPEG is a method of compression.  The image format 
 
42
using JPEG compression that is by far the most common is JFIF.  There is
 
43
also a subformat of TIFF that uses JPEG compression.
 
44
 
 
45
EXIF is an image format that is a subformat of JFIF (to wit, a JFIF 
 
46
file that contains an EXIF header as an APP1 marker).
 
47
.B jpegtopnm
 
48
handles EXIF.
 
49
 
 
50
JFIF files can have either 8 bits per sample or 12 bits per sample.
 
51
The 8 bit variety is by far the most common.  There are two versions
 
52
of the IJG JPEG library.  One reads only 8 bit files and the other
 
53
reads only 12 bit files.  You must link the appropriate one of these 
 
54
libraries with 
 
55
.BR jpegtopnm .  
 
56
Ordinarily, this means the library is in your shared library search
 
57
path when you run
 
58
.BR jpegtopnm .
 
59
 
 
60
.B jpegtopnm
 
61
generates output with either one byte or two bytes per sample depending on
 
62
whether the JFIF input has either 8 bits or 12 bits per sample.  You can
 
63
use 
 
64
.B pnmdepth
 
65
to reduce a two-byte-per-sample file to a one-byte-per-sample file if
 
66
you need to.
 
67
 
 
68
If the JFIF file uses the CMYK or YCCK color space, the input does not
 
69
actually contain enough information to know what color each pixel is.
 
70
To know what color a pixel is, one would have to know the properties of
 
71
the inks to which the color space refers.
 
72
.B jpegtopnm
 
73
interprets the colors using the common transformation which assumes
 
74
all the inks are simply subtractive and linear.
 
75
 
 
76
 
 
77
.SH OPTIONS
 
78
The options are only for advanced users:
 
79
.TP
 
80
.B \-dct int
 
81
Use integer DCT method (default).
 
82
.TP
 
83
.B \-dct fast
 
84
Use fast integer DCT (less accurate).
 
85
.TP
 
86
.B \-dct float
 
87
Use floating-point DCT method.
 
88
The float method is very slightly more accurate than the int method, but is
 
89
much slower unless your machine has very fast floating-point hardware.  Also
 
90
note that results of the floating-point method may vary slightly across
 
91
machines, while the integer methods should give the same results everywhere.
 
92
The fast integer method is much less accurate than the other two.
 
93
.TP
 
94
.B \-nosmooth
 
95
Use a faster, lower-quality upsampling routine.
 
96
.TP
 
97
.BI \-maxmemory " N"
 
98
Set limit on the amount of memory 
 
99
.B jpegtopnm
 
100
uses in processing large images.  Value is in thousands of bytes, or
 
101
millions of bytes if "M" is suffixed to the number.  For example,
 
102
.B \-maxmemory 4m
 
103
selects 4000000 bytes.  If 
 
104
.B jpegtopnm
 
105
needs more space, it uses temporary files.
 
106
.TP
 
107
.B \-adobe
 
108
.TP
 
109
.B \-notadobe
 
110
There are two variations on the CMYK (and likewise YCCK) color space that
 
111
may be used in the JFIF input.  In the normal one, a zero value for a color
 
112
components indicates absence of ink.  In the other, a zero value means the
 
113
maximum ink coverage.  The latter is used by Adobe Photoshop when it creates
 
114
a bare JFIF output file (but not when it creates JFIF output as part of
 
115
Encapsulated Postscript output).  
 
116
 
 
117
These options tell 
 
118
.B jpegtopnm
 
119
which version of the CMYK or YCCK color space the image uses.  If you
 
120
specify neither,
 
121
.B jpegtopnm
 
122
tries to figure it out on its own.  In the present version, it doesn't
 
123
try very hard at all: It just assumes the Photoshop version, since
 
124
Photoshop and its emulators seem to be the main source of CMYK and
 
125
YCCK images.  But with experience of use, future versions might be
 
126
more sophisticated.
 
127
 
 
128
If the JFIF image does not indicate that it is CMYK or YCCK, these
 
129
options have no effect.
 
130
 
 
131
If you don't use the right one of these options, the symptom is output
 
132
that looks like a negative.
 
133
 
 
134
.TP
 
135
.B \-dumpexif
 
136
Print the interpreted contents of any Exif header in the input file to the 
 
137
Standard Error file.  Similar to the program
 
138
.B jhead
 
139
(not part of the Netpbm package).
 
140
.TP
 
141
.B \-exif=\fIfilespec
 
142
Extract the contents of the EXIF header from the input image and write it
 
143
to the file 
 
144
.IR filespec .
 
145
.I filespec 
 
146
 
147
.B -
 
148
means write it to Standard Output.  In this case,
 
149
.B jpegtopnm
 
150
does not output the converted image at all.
 
151
 
 
152
.B jpegtopnm
 
153
writes the contents of the EXIF header byte-for-byte, starting with the
 
154
two byte length field (which length includes those two bytes).
 
155
 
 
156
You can use this file as input to 
 
157
.B ppmtojpeg
 
158
to insert an identical EXIF header into a new JFIF image.
 
159
 
 
160
If there is no EXIF header, 
 
161
.B jpegtopnm
 
162
writes two bytes of binary zero and nothing else.
 
163
 
 
164
An EXIF header takes the form of a JFIF APP1 marker.  Only the first
 
165
such marker within the JFIF header counts.
 
166
 
 
167
.TP
 
168
.B \-comments
 
169
Print any comments in the input file to the Standard Error file.
 
170
.TP
 
171
.B \-verbose
 
172
Print details about the conversion to the Standard Error file.
 
173
.TP
 
174
.BI \-tracelevel " n"
 
175
Turn on the JPEG library's trace messages to the Standard Error file.
 
176
A higher value of 
 
177
.I n
 
178
gets more trace information.
 
179
.B \-verbose
 
180
implies a trace level of at least 1.
 
181
 
 
182
.SH EXAMPLES
 
183
.LP
 
184
This example converts the color JFIF file foo.jpg to a PPM file
 
185
named foo.ppm:
 
186
.IP
 
187
.B jpegtopnm foo.jpg >foo.ppm
 
188
 
 
189
.SH HINTS
 
190
You can use 
 
191
.B ppmquant
 
192
to color quantize the result, i.e. to reduce the number of distinct colors
 
193
in the image.  In fact, you may have to if you want to convert the PPM
 
194
file to certain other formats.
 
195
.B ppmdither
 
196
Does a more sophisticated quantization.
 
197
.PP
 
198
Use
 
199
.B pnmscale
 
200
to change the dimensions of the resulting image.
 
201
.PP
 
202
Use
 
203
.B ppmtopgm 
 
204
to convert a color JFIF file to a grayscale PGM file.
 
205
.PP
 
206
You can easily use these converters together.  E.g.:
 
207
.IP
 
208
.B jpegtopnm foo.jpg | ppmtopgm | pnmscale .25 
 
209
.br
 
210
.B >foo.pgm
 
211
.PP
 
212
.B \-dct fast
 
213
and/or
 
214
.B \-nosmooth
 
215
gain speed at a small sacrifice in quality.
 
216
.PP
 
217
If you are fortunate enough to have very fast floating point hardware,
 
218
\fB\-dct float\fR may be even faster than \fB\-dct fast\fR.  But
 
219
on most machines \fB\-dct float\fR is slower than \fB\-dct int\fR;
 
220
in this case it is not worth using, because its theoretical accuracy
 
221
advantage is too small to be significant in practice.
 
222
 
 
223
Another program, 
 
224
.BR djpeg ,
 
225
is similar.  
 
226
.B djpeg
 
227
is maintained by the Independent JPEG Group and packaged with the 
 
228
JPEG library which 
 
229
.B jpegtopnm
 
230
uses for all its JPEG work.  Because of that, you may expect it to exploit
 
231
more current JPEG features.  Also, since you have to have the library to
 
232
run
 
233
.BR jpegtopnm ,
 
234
but not vice versa,
 
235
.B cjpeg
 
236
may be more commonly available.
 
237
.PP
 
238
On the other hand,
 
239
.B djpeg
 
240
does not use the NetPBM libraries to generate its output, as all the NetPBM
 
241
tools such as
 
242
.B jpegtopnm
 
243
do.  This means it is less likely to be consistent with all the other programs
 
244
that deal with the NetPBM formats.  Also, the command syntax of
 
245
.B jpegtopnm
 
246
is consistent with that of the other Netpbm tools, unlike
 
247
.BR djpeg .
 
248
 
 
249
.SH ENVIRONMENT
 
250
.TP
 
251
.B JPEGMEM
 
252
If this environment variable is set, its value is the default memory limit.
 
253
The value is specified as described for the
 
254
.B \-maxmemory
 
255
option.  An explicit
 
256
.B \-maxmemory 
 
257
option overrides any 
 
258
.BR JPEGMEM .
 
259
.SH SEE ALSO
 
260
.BR ppm (5),
 
261
.BR pgm (5),
 
262
.BR ppmtojpeg (1),
 
263
.BR ppmquant (1),
 
264
.BR pnmscale (1),
 
265
.BR ppmtopgm (1),
 
266
.BR ppmdither (1),
 
267
.BR pnmdepth (1),
 
268
.br
 
269
.BR djpeg (1),
 
270
.BR cjpeg (1),
 
271
.BR jpegtran (1),
 
272
.BR rdjpgcom (1),
 
273
.BR wrjpgcom (1),
 
274
.BR jhead (1)
 
275
.br
 
276
Wallace, Gregory K.  "The JPEG Still Picture Compression Standard",
 
277
Communications of the ACM, April 1991 (vol. 34, no. 4), pp. 30-44.
 
278
 
 
279
.SH LIMITATIONS
 
280
Arithmetic coding is not supported for legal reasons.
 
281
.PP
 
282
The program could be much faster.
 
283
 
 
284
.SH AUTHOR
 
285
.B jpegtopnm
 
286
and this man page were derived in large part from 
 
287
.BR djpeg ,
 
288
by the Independent JPEG Group.
 
289
The program is otherwise by Bryan Henderson on March 19, 2000.
 
290