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