The psmerge
program writes its output to the standard output channel (stdout
). This can be
redirected to a file or piped straight to a printer queue; e.g.:
or
The examples above simply converts an EPS file to a normal PostScript file, the only difference being that the normal PostScript file shifts the picture origin to the bottom left corner of the printable area on the printer. This is useful because if an EPS file is printed without conversion, the picture origin will be at the bottom left corner of the paper and on most printers this means that the bottom and left edges will lie outside the printable area and will be invisible.
The principle use of PSMERGE is to combine more than one EPS file into a single picture. For example:
will overlay the two pictures with their origins at the same place on the paper.
For line graphics and text the order of the files does not make any difference but if either picture contains filled areas or grey scale images it does. Filled areas and grey scales are opaque and will obliterate anything already plotted in the same region of the page. Therefore, for example, to overlay a contour map on a grey scale image, the file containing the contour map must appear after the one containing the image.
Pictures can be scaled, translated (shifted) and rotated. For example:
will shrink the picture to half its normal size, move the origin 1 inch to the right and 2 inches upwards and rotate it 10 degrees anti-clockwise.
Translations are in units of 1/72 of an inch1 and rotations are in degrees anti-clockwise.
PSMERGE applies transformations are applied in the order that they appear on the command line and
are cumulative, so that, for example, -r45 -r45
is equivalent to -r90
but -t72x72 -s2x2
does not
have the same effect as -s2x2 -t72x72
.
After each EPS file is processed the scaling factors are reset to unity and the translation and rotations reset to zero. The following example takes two A4 landscape pictures and pastes them one above the other on a single A4 page in portrait orientation:
If -e
appears on the command line anywhere, the output file will be another EPS file rather than
normal PostScript. This allows files to be processed by PSMERGE more than once in a pipeline using
the special file name -
(hyphen) which means “use the standard input as the input file”.
Therefore, the same effect as the previous example can be achieved with the following
command:
Instead of scaling each picture and positioning it on the page independently, the two pictures are combined into one and then this single picture rotated and scaled.
The operation could be performed in two steps with the output from the first stored in a temporary file:
The PSMERGE program uses the following command switches:
-e
-r
N -s
Mx
N -t
Mx
N 11/72 of an inch is sometimes referred to as a PostScript point and is the default unit for PostScript commands.