All formats

EPS (Encapsulated PostScript)

Full nameEncapsulated PostScript
Extensions.eps, .epsf, .epsi (with an ASCII preview)
MIME typeapplication/postscript (also seen: image/x-eps, application/eps)
Typevector graphic (a one-page PostScript program), can embed raster images
Starts with25 21 50 53 2D 41 64 6F 62 65 (%!PS-Adobe-3.0 EPSF-3.0) or C5 D0 D3 C6 (binary header with a TIFF or WMF preview)
SpecificationAdobe Technical Note 5002, Encapsulated PostScript File Format Specification 3.0, with the DSC Specification 3.0 (PDF)
Maintained byAdobe (no longer developed)
Licenseopen specification

An EPS file is a PostScript program that draws one picture and says how big it is. The %%BoundingBox comment gives the area the drawing covers, so a page layout program, word processor or LaTeX can place, scale and crop the graphic without understanding the PostScript inside. Programs that can’t run PostScript show an embedded low-resolution preview instead, or a gray box.

EPS was the standard exchange format for logos, illustrations and charts in print workflows. It’s still requested by some print shops and stock-image sites and produced by Illustrator, CorelDRAW, Inkscape, matplotlib, R and gnuplot. For new work, PDF does the same job better, and SVG is the vector format for the web.

When to use EPS#

File structure#

An EPS file is a PostScript file with extra rules:

%!PS-Adobe-3.0 EPSF-3.0
%%Creator: my program
%%Title: logo.eps
%%BoundingBox: 0 0 200 100
%%HiResBoundingBox: 0.000000 0.000000 200.000000 100.000000
%%LanguageLevel: 2
%%Pages: 1
%%EndComments
%%Page: 1 1
0.2 0.4 0.8 setrgbcolor
10 10 180 80 rectfill
1 setgray
/Helvetica-Bold findfont 36 scalefont setfont
30 38 moveto (LOGO) show
showpage
%%EOF

Bounding box#

%%BoundingBox: llx lly urx ury gives the lower-left and upper-right corners in integer PostScript points (1/72 inch). %%HiResBoundingBox gives the same with decimals. The drawing doesn’t have to start at 0,0: an EPS file cut out of a page often has a box like 72 500 300 720.

A wrong bounding box is the most common EPS problem: the graphic is clipped or surrounded by white space. Ghostscript computes the real box:

Shell
gs -dNOPAUSE -dBATCH -dSAFER -q -sDEVICE=bbox in.eps
# %%BoundingBox: 10 10 190 90
# %%HiResBoundingBox: 10.000000 10.000000 190.000000 90.000000

Previews#

Programs that can’t render PostScript show a preview. There are three kinds:

Preview Where it is Used by
TIFF or WMF in a binary header (“DOS EPS”) binary header before the PostScript Windows programs, most common
EPSI hex bitmap in %%BeginPreview … %%EndPreview comments Unix programs; plain text
PICT resource fork classic Mac OS only; lost when the file is copied to another system

Binary header (DOS EPS)#

A file with a TIFF or WMF preview starts with a 30-byte header. All numbers are little-endian:

Offset Size Field
0 4 magic C5 D0 D3 C6
4 4 offset of the PostScript section
8 4 length of the PostScript section
12 4 offset of the WMF preview (0 if none)
16 4 length of the WMF preview
20 4 offset of the TIFF preview (0 if none)
24 4 length of the TIFF preview
28 2 checksum of bytes 0-27, or FF FF to ignore
C5 D0 D3 C6               magic
1E 00 00 00               PostScript starts at offset 30
A4 2B 00 00               PostScript length 11172
00 00 00 00 00 00 00 00   no WMF preview
C2 2B 00 00 9C 40 00 00   TIFF preview at 11202, length 16540
FF FF                     no checksum
25 21 50 53 2D 41 64 6F   %!PS-Ado...

To read the PostScript, seek to the offset and read the given length. Tools that expect %!PS at the start fail on such files; ps2eps, Ghostscript and most libraries handle both.

EPSI preview#

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 200 100
%%EndComments
%%BeginPreview: 200 100 1 100
% FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
% ...
%%EndPreview

The numbers after %%BeginPreview: are width, height, bits per pixel and the number of comment lines that follow. Ghostscript’s ps2epsi script adds such a preview.

Converting EPS#

Shell
# EPS to PDF, page cropped to the bounding box (TeX Live / MiKTeX)
epstopdf in.eps
gs -dNOPAUSE -dBATCH -dSAFER -dEPSCrop -sDEVICE=pdfwrite -sOutputFile=out.pdf in.eps

# EPS to PNG at 300 dpi with a transparent background
gs -dNOPAUSE -dBATCH -dSAFER -dEPSCrop -sDEVICE=pngalpha -r300 -sOutputFile=out.png in.eps

# EPS to SVG
inkscape in.eps --export-filename=out.svg

# PDF page to EPS
pdftops -eps -f 1 -l 1 in.pdf out.eps          # Poppler
gs -dNOPAUSE -dBATCH -dSAFER -sDEVICE=eps2write -sOutputFile=out.eps in.pdf

Without -dEPSCrop, Ghostscript places the graphic on a full default page (Letter or A4) at its bounding box position.

Specifications and documentation#

Software that opens EPS files#

SoftwareWindowsmacOSLinuxWebCanNotes
SumatraPDF✓viewfree, open source; opens .eps when Ghostscript is installed
Adobe Illustrator✓✓view, edit, create, convertcommercial; the most common EPS editor
Inkscape✓✓✓view, edit, create, convertfree, open source; imports EPS through Ghostscript
Affinity✓✓view, edit, create, convertimports and exports EPS
CorelDRAW✓✓view, edit, create, convertcommercial
GIMP✓✓✓view, convertrasterizes EPS through Ghostscript
LibreOffice✓✓✓view, convertfree; Draw imports EPS, shows the preview in documents
Ghostscript✓✓✓view, convertinterpreter; gs, ps2pdf, eps2write; AGPL or commercial
Okular✓viewfree, open source, through libspectre
Evince✓viewGNOME document viewer
IrfanView✓view, convertfree for non-commercial use; needs Ghostscript and the PostScript plugin
XnView MP✓✓✓view, convertfree for private use; uses Ghostscript
ImageMagick✓✓✓convertcommand line; reads EPS through Ghostscript

macOS Preview stopped opening EPS in macOS 13. On a current Mac use Illustrator, Affinity or Inkscape, or convert with Ghostscript (brew install ghostscript).

Libraries#

Open-source libraries that render, inspect and write EPS. See all EPS libraries for a comparison.

C/C++cairo, Ghostscript, libspectre
C#Ghostscript.NET, Magick.NET
Javaxmlgraphics-commons
Gocanvas, gonum/plot
PythonMatplotlib, Pillow, pycairo
RubyMiniMagick
Rustcairo-rs
PHPImagick