1PSTOIMG(1)            User Contributed Perl Documentation           PSTOIMG(1)
2
3
4

NAME

6       pstoimg - Convert a PostScript file to a bitmap image using Ghostscript
7       and the Netpbm utilities
8

SYNOPSIS

10       pstoimg -help -version
11
12       pstoimg [ -antialias ] [ -aaliastext ] [ -center num ] [ -color num ]
13       [ -crop code ] [ -debug ] [ -density num] [ -depth num ] [ -discard ]
14       [ -flip code ] [ -geometry XxY ] [ -interlaced ] [ -margins X,Y ]
15       [ -multipage ] [ -out file ] [ -quiet ] [ -rightjustify num ]
16       [ -scale num ] [ -tmp path ] [ -topjustify [x]num ] [ -transparent ]
17       [ -type type ] [ -shoreup num[d] ] [ -white ] file [ file2 ... ]
18

OPTIONS

20       The command line options may be abbreviated to the shortest unique pre‐
21       fix.
22
23       -help
24           Show this help page and exit.
25
26       -version
27           Show the release and version of pstoimg and exit.
28
29       -antialias
30           Use Ghostscript's anti-aliasing feature for rendering "softer"
31           images.  This applies to lines and edges of polygonal and oval or
32           circular shapes.  Only valid if Ghostscipt 4.03 or higher is
33           installed.
34
35       -aaliastext
36           Use Ghostscript's anti-aliasing feature for "smoother" font charac‐
37           ters, without the jagged edges. Similar to -antialias for graphic
38           components.  Only valid if Ghostscipt 4.03 or higher is installed.
39
40       -center num
41           Add the appropriate amount of whitespace to the left of the image
42           so that the image appears to be centered in a total width of num
43           pixels.
44
45       -crop code
46           Crop the bitmap from the given directions. code may be a string of
47           several cropping instructions, which are executed strictly in the
48           given order. Possible values are: h (horizontal, i.e. crop top and
49           bottom), v (vertical), tblr (top, bottom, left, right) and a (all
50           directions). A special case is s: "shave" the image at the bottom,
51           but only if a single line of whitespace exists.
52
53       -debug
54           Turn on debugging output. This can get rather verbose. Any interme‐
55           diate files generated are not removed to help debugging.
56
57       -density num
58           The density (resolution) in DPI in which to render the bitmap. The
59           default is 72.
60
61       -depth num or -color num
62           Specify the color depth of the bitmap. Legal values are 1 (black &
63           white), 8 (256 colors) and 24 (true color).
64
65       -discard
66           Delete the input postscript file if the conversion was successful.
67           Setting the environment DISCARD to a true value (as perl sees it)
68           has the same effect.
69
70       -flip code
71           Flip all generated output bitmaps. The following codes are recog‐
72           nized: lr (flip left-right), tb (flip top-bottom), xy (flip bot‐
73           tom/left-top/right), r90 and ccw (rotate by 90 degrees counter‐
74           clockwise), r270 and cw (rotate 90 degrees clockwise) and r180
75           (rotate 180 degrees).
76
77       -geometry XxY
78           Render only this "window" of the PostScript file. If given, this
79           option can dramatically reduce memory requirements and speed up
80           conversion. The geometry is automatically detected in case of EPS
81           files (Encapsulated PostScript).
82
83       -interlaced
84           Generate an interlaced bitmap. Interlaced images build up from
85           coarse to fine as they are loaded. This option may not work on
86           every installation and/or bitmap type, depending of the capabili‐
87           ties of external programs.
88
89       -margins X,Y
90           The offset of the rectangle in the postscript file that is going to
91           be rendered from top/left. Can be used together with -geometry to
92           further reduce the size of the intermediate bitmap file generated
93           by Ghostscript.
94
95       -multipage
96           Process a multi-page PostScript file, i.e. create an individual
97           bitmap for every page. The resulting files are numbered: The deci‐
98           mal number (starting with 1) is appended to the basename of the
99           PostScript input file (or the basename of the filename specified
100           with -out), while keeping the extension.
101
102       -out file
103           The file where to write the bitmap. If multiple PostScript files
104           are supplied on the command line, this option is ignored. The bit‐
105           map type extension is appended automatically if file does not con‐
106           tain a dot.  In connection with -multipage file is extended by the
107           page number as shown in this example:
108
109           -outfile foo.gif  --------> foo1.gif, foo2.gif, ...
110
111       -quiet
112           Do not print anything except error messages.
113
114       -rightjustify num
115           Add the appropriate amount of whitespace to the left of the image
116           so that it appears to be aligned to the right in a total width of
117           num pixels.
118
119       -scale factor
120           Scale the image by factor. Valid choices are any numbers greater
121           than zero. Useful choices are numbers between 0.1 - 5.  Large num‐
122           bers may generate very large intermediate files and will take
123           longer to process. If this option is omitted, the environment SCALE
124           is considered.
125
126       -shoreup num[d]
127           Make height and width of the bitmap(s) an exact multiple of num. If
128           num is followed by a "d", then half the extra vertical space is
129           placed underneath. This option is useful, if you want to have
130           "blown-up" images of high quality for print, but downscale them in
131           HTML using "<IMG WIDTH=x HEIGHT=y>". If the actual image is is not
132           an integer multiple of x,y then browsers tend to display distorted
133           images.
134
135       -tmp path
136           Use path to store temporary files. Defaults to /tmp on this instal‐
137           lation. This parameter can be set by the environment TMP or TEMP,
138           too.
139
140       -topjustify [x]num
141           Add padding whitespace to the image so that it gets a defined
142           height.  If an integer value is given, it defines the total height.
143           The whitespace is added at the bottom. If the number is preceded by
144           "x", then this multiple of the image height is added as whitespace
145           at the bottom.
146
147       -transparent
148           Generate transparent bitmaps, i.e. the background color (white) is
149           transparent if viewed with certain viewers (e.g. browsers). This
150           option may not be available due to missing capabilities of external
151           programs.
152
153       -type type
154           Instruct pstoimg to render the bitmap in type format. Depending on
155           the local installation, pstoimg is capable of generating either GIF
156           or PNG bitmaps. This site features the following types: png gif
157
158           If omitted, the first type in this list is taken.
159
160       -white
161           Remove TeX's page color information from the PostScript file before
162           converting so that a white background is used.
163

DESCRIPTION

165       pstoimg iterates over the given input files and runs them through
166       Ghostscipt. The resulting pnm (portable anymap files) are processed
167       with different Netpbm tools (cropping, color mapping, aligning, ...)
168       and finally converted into (currently) either GIF or PNG format. The
169       bitmaps can now be included e.g. in WWW pages.
170
171       The PostScript file is converted as is. If a valid bounding box is
172       found (EPS format), then only this area is converted. The image is not
173       cropped by default.
174

RETURN VALUE

176       0   if everything went all right
177
178       x   (x != 0) something went wrong. See the message output.
179

EXAMPLES

181       "pstoimg foo.ps"
182           Convert the first page of foo.ps to the default bitmap type.
183
184       "pstoimg -type png -crop a -trans -interlace foo.ps"
185           Same as above, but force png output and crop all the whitespace
186           around the image and make the color white transparent and generate
187           an interlaced bitmap.
188
189       "pstoimg -multi -out bar -type gif -crop a foo.ps"
190           Consider foo.ps a multiple page PostScript file and create output
191           files bar1.gif, bar2.gif, etc.
192

ENVIRONMENT

194       DENSITY, DEPTH, DEBUG, DISCARD
195           See -density, -depth, -debug, -discard, respectively.
196
197       GS_LIB
198           This variable is set to the path(s) where Ghostscript libraries
199           have been found on this system during configuration, but only if
200           the built-in paths are not correct. This fixes the problem of relo‐
201           cation that is quite common on Win32 installations. This behavior
202           can be overridden by setting GS_LIB manually before starting
203           pstoimg.
204
205       LATEX2HTMLDIR
206           The directory where the LaTeX2HTML library and perl modules are
207           found.  Defaults to "/usr/share/latex2html" on this installation.
208
209       OUTFILE
210           Setting this has the same effect as specifying -out. Please do not
211           rely on this feature any more, it will disappear from the next
212           releases!
213
214       PAPERSIZE
215           The papersize to use by Ghostscript to render the image. pstoimg
216           tries hard to optimize for rendering on the smallest possible bit‐
217           map size.  Still this option is there to enable tuning by hand,
218           although it is deprecated. If pstoimg finds a better setting, this
219           parameter is ignored.
220
221       SCALE
222           See the discussion of -scale.
223
224       TMP and TEMP
225           Unless overridden by -tmp, these variables denote a directory where
226           to store temporary files. TMP is considered first, then TEMP.
227

SEE ALSO

229       gs, pnmcrop, pnmquant, pbmmake, pnmcat, pnmfile, pnmflip, ppmtogif,
230       pnmtopng, giftool, giftrans.
231

NOTES

233       Several people have suggested to use ImageMagick's convert instead of
234       pstoimg. A few comments on this: convert uses (of course) Ghostscript
235       for conversion of PostScript to bitmap, so one still needs gs. And for
236       the special requirements of LaTeX2HTML convert's features are not suf‐
237       ficient. The ImageMagick toolset has everything in place, but it has
238       some overhead that can prove killing when processing some 100 images.
239       pstoimg only does what it really has to, so it should be quite effi‐
240       cient. Don't get me wrong - I like ImageMagick, but not in the context
241       of LaTeX2HTML.
242

CAVEATS

244       This utility is automatically configured and built to work on the local
245       setup. If this setup changes (e.g. some of the external commands are
246       moved), the script has be be reconfigured.
247
248       Despite the portability of perl, a pstoimg configured on UNIX will
249       probably not work on Win32 and vice versa.
250

BUGS

252       This is a major enhancement release, so there may be a few bugs. As the
253       user inteface changed a bit, some of your tools that were using pstoimg
254       may not work any more.
255
256       Please report bugs to latex2html@tug.org, stating the (debug) output of
257       pstoimg, your perl version and the versions of the external tools.
258       Best is to include the cfgcache.pm file from the configuration proce‐
259       dure.
260

AUTHOR

262       Marek Rouchal <marek@saftsack.fs.uni-bayreuth.de>
263

HISTORY

265       This script went through a long evolution, beginning with a modifica‐
266       tion of Doug Crabill's <dgc@cs.purdue.edu> ps2epsi script.  The first
267       perl version was done by Nikos Drakos <nikos@cbl.leeds.ac.uk>.  It was
268       gradually improved by numerous LaTeX2HTML developers: Ross Moore
269       <ross@mpce.mq.edu.au>, Jens Lippmann <lippmann@rbg.informatik.tu-darm‐
270       stadt.de> and others (sorry for not mentioning everyone and thanks for
271       your contributions).
272
273
274
275perl v5.8.4                       2005-03-20                        PSTOIMG(1)
Impressum