eps2png Manual Page
Name
eps2png (version 2011/06/01) - converts EPS files to PNG
Synopsis
eps2png [options] [psfile] epsfile(s)
The shell script eps2png converts the EPS files specified on the command line to PNG. The files to be converted must have the extension .eps, but you do not have to specify the extension on the command line explicitly.
Options
Sets the antialiasing sampling size. Allowed values for the sampling size are 0 (no antialiasing), 1, 2 and 4. The default value is 4. If you provide a single sample size (as in -a 1), the same sample size is used for text and graphics antialiasing. If you provide two sample sizes (as in -a 2,0), the first is used for graphics and the second for text.
-B
Use this option to automatically detect the tightest possible Bounding Box around the image. This may help if the EPS file is missing a correct Bounding Box, or to get rid of a small white margin around the image.
-C
Normally, eps2png maps colours through a CIE colour space when converting between CMYK and RGB, which often results in more accurate colours. The -C switch turns this feature off.
-d res[,vres]
This option specifies the resolution used to render the image (in dots per inch). The default resolution is 300. You can specify different horizontal and vertical resolutions. For instance, -d 300,200 specifies a horizontal resolution of 300 dpi and a vertical resolution of 200 dpi.
-f
Force eps2png to overwrite existing files, instead of pausing and prompting you.
-h height
Scale the image to the desired height. Acceptable units for the height are cm, mm, in and px. For example, -h 200px creates an image of 200 pixels in height (at the given resolution). If you don't specify a unit, the height is interpreted in PostScript points, of which there are 72 per inch. The horizontal scaling will be equal to the vertical scaling if you do not use the -w option as well. The -s option is ignored when you use this option.
-H
Use the HiResBoundingBox instead of the normal BoundingBox to determine the image size.
-m mode
Use this option to specify the png file mode. Possible modes are 16, 48, 256, 16m, alpha, mono and gray. The default is 16m. Not all these modes may be available to you if you have an older version of Ghostscript.
-o directory
Choose the output directory (the output directory is equal to the input directory by default).
-r angle
Rotate the image counter-clockwise by the specified angle (in degrees). Scaling is always performed before rotation.
-s sc[,ysc]
Scale the image by a given scaling factor. If you specify two scaling factors (as in -s 1,2), the first is used for horizontal scaling, and the second for vertical scaling. Scaling is always performed before rotation.
-t
Create a transparent PNG file (equivalent to -m alpha).
-w width
Scale the image to the desired width. Units are the same as for the -h option. The vertical scaling will be equal to the horizontal scaling if you do not use the -h option as well. The -s option is ignored when you use this option.
Prepending PostScript files
If a file with extension .ps appears in the list of files passed on to eps2png, the contents of that file will be processed just before each next .eps file in the list is rendered. This allows for advanced control over the rendering procedure.
One possible use of this feature is to apply a PostScript CRD to dictate how eps2png should render an EPS file to a different colour space (e.g. an EPS file in CMYK colours to a PNG file in RGB colours). For example, if you have an ICC Color Profile SWOP.icc, you can use the icc2ps utility that comes with LitteCMS to create a CRD, and pass this on to eps2png as follows:
icc2ps -u -oSWOP.icc > CRD.ps
echo setcolorrendering >> CRD.ps
eps2png CRD.ps foo.eps
Further examples
To convert all EPS files in the current directory to PNG, simply type
eps2png *.eps
The following two commands both create an image of 300 by 200 pixels, but the first will have a print size of 1 by 1 inch, whereas the second will have a print size of 1.5 by 1 inch:
eps2png -d 300,200 -w 300px -h 200px foo.eps
eps2png -d 200 -w 1.5in -h 1in foo.eps