1Pstopnm User Manual(0) Pstopnm User Manual(0)
2
3
4
6 pstopnm - convert a PostScript file to a PNM image
7
8
10 pstopnm
11
12 [-stdout]
13
14 [-forceplain]
15
16 [-help]
17
18 [-dpi=dpi]
19
20 [-xsize=pixels] [-ysize=pixels]
21
22 [-xborder=frac] [-yborder=frac]
23
24 [-landscape]
25
26 [-portrait]
27
28 [-nocrop]
29
30 [-pbm
31
32 |-pgm
33
34 |-ppm]
35
36 [-llx=s] [-lly=s] [-urx=s] [-ury=s]
37
38 [-verbose]
39
40 [-xmax=pixels] [-ymax=pixels]
41
42
43 psfile[.ps]
44
45
47 Minimum unique abbreviation of option is acceptable. You may use dou‐
48 ble hyphens instead of single hyphen to denote options. You may use
49 white space in place of the equals sign to separate an option name from
50 its value.
51
52
54 This program is part of Netpbm(1).
55
56 pstopnm reads a PostScript file as input and produces PBM, PGM, or PPM
57 images as output. This program simply uses GhostScript to render a
58 PostScript file with its PNM device drivers. If you don't have Ghost‐
59 Script installed or the version you have installed was not built with
60 the relevant PNM device drivers, pstopnm will fail. You can see if you
61 have the proper environment by issuing the command gs --help . If it
62 responds and lists under 'Available Devices' pbm, pbmraw, pgm, pgmraw,
63 pnm, pnmraw, ppm, or ppmraw, you're in business.
64
65 pstopnm uses the value of the GHOSTSCRIPT environment variable as the
66 file name for the Ghostscript program. If GHOSTSCRIPT is not set,
67 pstopnm searches your PATH for a regular file named gs. If it doesn't
68 find one, it assumes Ghostscript is in the file /usr/bin/gs.
69
70 pstopnm does not use the Netpbm libraries to generate the output files,
71 so may not be entirely consistent with most Netpbm programs.
72
73 psfile[.ps] is the name of the input file. pstopnm will add the ps to
74 the end of the name you specify if no file exists by the exact name you
75 specify, but one with added does. Use - to indicate Standard Input.
76
77 If you use the -stdout option, pstopnm outputs images of all the pages
78 as a multi-image file to Standard Output. Otherwise, pstopnm creates
79 one file for each page in the Postscript document. The files are named
80 as follows: If the input file is named psfile.ps, the name of the files
81 will be psfile001.ppm, psfile002.ppm, etc. The filetype suffix is
82 .ppm, .pgm, or .pbm, depending on which kind of output you choose with
83 your invocation options. If the input file name does not end in .ps,
84 the whole file name is used in the output file name. For example, if
85 the input file is named psfile.old, the output file name is
86 psfile.old001.ppm, etc.
87
88 Note that the output file selection is inconsistent with most Netpbm
89 programs, because it does not default to Standard Output. This is for
90 historical reasons, based on the fact that the Netpbm formats did not
91 always provide for a sequence of images in a single file.
92
93 Each output image contains a rectangular area of the page to which it
94 pertains. See the Dimensions section ⟨#dimensions⟩ for details on
95 what part of the input image goes into the output image and how big it
96 is in the output and what borders and margins are in the output image.
97
98 It has been reported that on some Postscript Version 1 input, Ghost‐
99 script, and therefore pstopnm, produces no output. To solve this prob‐
100 lem, you can convert the file to Postscript Version 3 with the program
101 ps2ps. It is reported that the program pstops does not work.
102
103
104 Dimensions
105 This section describes what part of the input image gets used in the
106 output and the dimensions of the output, including borders and back‐
107 ground.
108
109 Note that an output image is associated with a single input page.
110
111 pstopnm starts by taking a rectangular area from the input page. That
112 is called the subject image.
113
114 pstopnm may add borders to the subject image to form what is called the
115 bordered subject image.
116
117 pstopnm places the bordered subject image in the center of the output
118 image and clips the edges as necessary to fit the computed output image
119 size.
120
121 The location of the subject image in the Postscript input page is
122 defined by four numbers, the lower left corner and the upper right cor‐
123 ner x and y coordinates. These coordinates are usually specified by
124 the BoundingBox DSC statement (a Postscript comment) in the PostScript
125 file, but they can be overridden by the user by specifying one or more
126 of the following options: -llx, -lly, -urx, and -ury.
127
128 The presence and thickness of a border to be added to the subject image
129 to form the bordered subject image is controlled by the options -xbor‐
130 der and -yborder. If pstopnm does not find a BoundingBox statement in
131 the input, and you don't specify image area coordinates on the command
132 line, pstopnm uses default values. If your input is from Standard
133 Input, pstopnm does not use the BoundingBox values (due to the techni‐
134 cal difficulty of extracting that information and still feeding the
135 file to Ghostscript), so you either have to specify the image area
136 coordinates or take the default.
137
138 The output image size is a confusing thing. In a Postscript file,
139 things have spatial dimensions. For example, a particular line may be
140 3 centimeters long. A Postscript printer is supposed to print the line
141 3 centimeters long, using however many pixels that takes, without
142 regard to how big the sheet of paper on which it is printing is. In a
143 PNM image, by contrast, there is no spatial dimension; there are only
144 pixels. You might have a line that is 100 pixels long, but the PNM
145 image says nothing about how long that line should be on a printed
146 page.
147
148 pstopnm fills the role of a Postscript printer. The PNM image is a
149 virtual printed page. pstopnm must determine how many pixels it will
150 use in the output image to represent an inch of input image, which is
151 the "output device resolution." Think of it as the number of dots per
152 inch the virtual printer prints on the virtual page.
153
154 The simplest thing is for you to tell pstopnm exactly what output
155 device resolution to use, using the -dpi option. If you say for exam‐
156 ple -dpi=300 and the bordered subject image is 2 inches by 2 inches,
157 the PNM output will be 600 pixels by 600 pixels.
158
159 Or you can set the output image dimensions with -xsize and -ysize. For
160 example, if you say -xsize=1000 -ysize=1000 and the bordered subject
161 image is 2 inches by 2 inches, the output image is 1000 by 1000 pixels,
162 with each pixel representing 1/500 inch of input image.
163
164 If you specify one of -xsize and -ysize and not the other, pstopnm
165 defaults the other such that the output image has the same aspect ratio
166 as the bordered subject image.
167
168 If you specify neither the output size nor the output device resolu‐
169 tion, pstopnm does some weird computation which exists mainly for his‐
170 torical reasons:
171
172 If you specify -nocrop, pstopnm uses the values of -xmax and -ymax for
173 the output image dimensions. These default to 612 and 792 pixels,
174 respectively.
175
176 The final case, the default, is where you don't specify any size or
177 resolution options of -nocrop. This is the most complicated case. In
178 this case, pstopnm first chooses an output device resolution that would
179 generate the number of pixels indicated by -xmax and -ymax from the
180 bordered subject image. Then, based on that resolution, it chooses an
181 output image size that is just large enough to accomodate the subject
182 image (no borders). Remember (above) that pstopnm trims the edges of
183 the bordered subject image to fit the computed output size.
184
185
186
188 -forceplain
189 forces the output file to be in plain (text) format. Other‐
190 wise, it is in raw (binary) format. See pbm(1), etc.
191
192
193 -llx=bx
194 selects bx as the lower left corner x coordinate (in inches) on
195 the Postscript input page of the subject image. See the
196 Dimensions section ⟨#dimensions⟩ .
197
198
199 -lly=by
200 selects by as the lower left corner y coordinate (in inches) on
201 the Postscript input page of the subject image. See the
202 Dimensions section ⟨#dimensions⟩ .
203
204
205 -landscape
206 renders the image in landscape orientation.
207
208
209 -portrait
210 renders the image in portrait orientation.
211
212
213 -nocrop
214 This option causes pstopnm to make the output image exactly the
215 dimensions of the bordered subject image. By default, pstopnm
216 makes the output image the dimensions specified by -xmax and
217 -ymax. See the Dimensions section ⟨#dimensions⟩ .
218
219
220 -pbm
221
222 -pgm
223
224 -ppm selects the format of the output file. By default, all files
225 are rendered as PPM.
226
227
228 -stdout
229 causes output to go to Standard Output instead of to regular
230 files, one per page (see description of output files above).
231 Use pnmsplit to extract individual pages from Standard Output.
232
233
234 -urx=tx
235 selects tx as the upper right corner x coordinate (in inches) on
236 the Postscript input page of the subject image. See the
237 Dimensions section ⟨#dimensions⟩ .
238
239
240 -ury=ty
241 selects ty as the upper right corner y coordinate (in inches) on
242 the Postscript input page of the subject image. See the
243 Dimensions section ⟨#dimensions⟩ .
244
245
246
247 -verbose
248 prints processing information to stdout.
249
250
251 -xborder=frac
252 specifies that the left and right borders added to the subject
253 image are to be frac times the subject image width. The default
254 value is 0.1. See the Dimensions section ⟨#dimensions⟩ .
255
256
257
258 -xmax=xmax
259 specifies that the output image is to be xmax pixels wide. The
260 default is 612. See the Dimensions section ⟨#dimensions⟩ .
261
262
263
264 -xsize=xsize
265 specifies that the output image is to be xsize pixels wide. See
266 the Dimensions section ⟨#dimensions⟩ .
267
268
269 -yborder=frac
270 specifies that the top and bottom borders added to the subject
271 image are to be frac times the subject image height. The
272 default value is 0.1. See the Dimensions section ⟨#dimensions⟩
273 .
274
275
276
277 -ymax=ymax
278 specifies that the output image is to be ymax pixels high. The
279 default is 792. See the Dimensions section ⟨#dimensions⟩ .
280
281
282 -ysize=ysize
283 specifies that the output image is to be ymax pixels high. See
284 the Dimensions section ⟨#dimensions⟩ .
285
286
287 -dpi=dpi
288 specifies the output device resolution, in dots per inch, of the
289 Postscript printer that pstopnm simulates. This is the number
290 of PNM pixels pstopnm generates for each inch of image. See the
291 Dimensions section ⟨#dimensions⟩ .
292
293 This option was new in Netpbm 10.21 (March 2004).
294
295
296
297
298
300 The program will produce incorrect results with PostScript files that
301 initialize the current transformation matrix. In these cases, page
302 translation and rotation will not have any effect. To render these
303 files, probably the best bet is to use the following options:
304
305 pstopnm -xborder 0 -yborder 0 -portrait -nocrop file.ps
306
307 Additional options may be needed if the document is supposed to be ren‐
308 dered on a medium different from letter-size paper.
309
310
312 gs, pnmtops(1), psidtopgm(1), pbmtolps(1), pbmtoepsi(1), pnmsplit(1),
313 pstofits
314
315
316
317
319 Copyright (c) 1992 Smithsonian Astrophysical Observatory
320
321 PostScript is a Trademark of Adobe Systems Incorporated.
322
323
324
326 Alberto Accomazzi, WIPL, Center for Astrophysics.
327
328
329
330netpbm documentation 28 May 2003 Pstopnm User Manual(0)