peps-1.0 allows you to print encapsualted PostScript files. Specifically, it allows you to convert an EPS file into a bitmap.
Note the word allows: peps-1.0 does not do the conversion for you. Rather, it prepares the EPS file for a bitmap conversion by Ghostscript, which must already be installed on your system.
Why would you need peps-1.0? Can Ghostscript not convert EPS files into bitmaps by itself?
First of all, Ghostcript can convert any PostScript file into a bitmap. But, an EPS file, while written in PostScript, must be fitted into a regular PostScript file before printing—or converting to a bitmap.
Secondly, while Ghostscript is capable of anti-aliasing, most of its drivers do not support it. In fact, in a typical Unix installation, only one Ghostscript driver supports anti-aliasing, namely its pnm driver, which produces bitmaps in the portable graymap (PGM) and portable pixmap (PPM) formats. Numerous filters exist to convert these two types of bitmaps into just about any other bitmap format.
Take a look at this picture:
It suffers from a serious case of aliasing. To see it, compare the connectors on the FreeBSD Box and on Windows 95 with those on the Router. They are different even though their original PostScript code is identical. Which one is correct?
Now, take a look at this picture:
It was produced from the same EPS original, but using 4-bit anti-aliasing.
The above graphics are graymaps, but they are not in the PGM format. Rather, they are portable network graphic (PNG) files: peps-1.0 lets you create PNG files in addition to PNM files. If you want to create PNG files, however, you need to have pnmtopng installed somewhere on your Unix path.
The simplest way to use peps-1.0 is by typing the program name (peps) followed by the name of the input file. For example:
% peps tiger.ps
This will convert the file tiger.ps (which comes as part of the Ghostscript distribution) into a PGM bitmap, using peps-1.0 defaults, which means vertical and horizontal resolution of 100, 4-bit anti-aliasing, using the safe mode, sending the output to stdout.
Usually, defaults are not good enough. For example, for the above images, the resolution of 100 was correct. In the case of tiger.ps, that resolution would result in a very huge bitmap.
The -r switch followed by a number defines the resolution of the image. The larger the number, the larger the resultant bitmap.
You can also set the vertical and horizontal resolution separately, using the -h and the -v switches.
The -p switch will pipe the result through pnmtopng. Thus,
% peps -r 36 -p tiger.ps
will produce this image:
% peps -v 36 -h 18 -p tiger.ps
The -x, -X, -y, and -Y switches allow you to add extra space to the left (-x), right (-X), bottom (-y), and the top (-Y) of the image. This is the same as creating a frame for the image. You can also use negative numbers, which will crop the image instaead:
% peps -r 36 -x -100 -X -100 -Y 20 -p tiger.ps
Please note that these numbers are in Postscript points, not in the number of pixels to add (or cut). That means that when you change the resolution of the output, the frame/crop will keep its relative size: The result will look exactly the same, but will be resized as necessary.
The -a switch defines the angle of rotation of the image in degrees, about the center of the image. By default the angle is 0. A positive angle rotates counter-clockwise, a negative one clockwise.
Rotation almost always results in parts of the image being cut off. This can be prevented by adding some extra borders as described above.
% peps -r 36 -p -x 60 -y 40 -Y 50 -a 30 tiger.ps
PostScript is not just an image description language. It is a true programming language which allows you to read and write files on the system. By default, peps-1.0 tells Ghostscript to ignore any commands to write to files. This is a safety feature. Without it, you might download an EPS file from the web, and be surprised that some of your data was mysteriously wiped out.
If, however, you want to disable this safeguard, use the -s switch.
The -g and -t switches control anti-aliasing. The -g switch controls the anti-aliasing of graphics, the -t switch controls the anti-aliasing of text.
These two switches must be followed by the number of bits to use for anti-aliasing. The valid values are 1 (no anti-aliasing), 2 (some anti-aliasing), and 4 (full anti-aliasing).
The default value is 4 for both.
Finally, the -o switch allows you to declare an output file. By default, the output goes to stdout, but you can send it to a file using this option. For example,
% peps -p -o tiger.png tiger.ps
will send the output to tiger.png.
All switches can be listed in any order. If a switch contradicts another switch, whichever switch is listed later will win.
peps-1.0 is distributed in source code from ftp.peps.redprince..net/unix/peps by ftp, and www.peps.redprince.net/peps/1.0/ by html.
The home page is www.peps.redprince.net.
Copyright © 2001 G. Adam Stanislav
All rights reserved