EPS Utility Toolbox

Version 1.22 (187 KB) by Kesh Ikuma
A set of functions to generate publisher-happy EPS images
Updated 10 Oct 2014

View License

EPS Utility Toolbox consists of several functions to enhance the outputs of the built-in EPS print engine. This toolbox is aimed to:
* Improve EPS standard compliance: http://partners.adobe.com/public/developer/ps
* Provide post-generation tweaks
Run epssetup.m first to set up the toolbox.
Toolbox Setup and Configuration
epssetup - Run this first to use this toolbox
epsfontpath - Get/set postscript font search path
epsfontalias - Get/set postscript font aliases
epsfontlist - Get the list of postscript fonts in the search path

EPS File Generation and Conversion
epswrite - Save figure as an EPS image (with fixes)
eps2raster - Convert EPS image to PNG, BMP, JPEG, or TIFF image (req. Ghostscript)

EPS File Manipulation
epsembedfont - Embed/de-embed postscript fonts (can embed subset or unencrypted font dictionaries)
epssetlinestyle - Set line styles (dotted, dashed, and dash-dot)
epssetbgcolor - Set background color (supports transparency)
epspreview - Add/remove TIFF preview (req. Ghostscript)
epssetbbox - Set bounding box position and size

EPS File Information
epsgetbbox - Get bounding box
epsgetfonts - Get fonts used
EPS Fix-It-Up Functions (called internally by epswrite.m)
epsfixfonts - Fix font related issues
epsfixbackground - Set figure and axes properties (especially Color)
epscleancolordict - Clean up RGB color definitions

Type 'help epsutil' to get the command window help. Indivisual m-files also include full command-window help text.

Some files requires Ghostscript (www.ghostscript.com) to be installed on the computer.

To set resolution and size of the EPS image:

epswrite('fig.eps','Size',[2 4],'Resolution',600);

Size (= [width height]) are specified in inches and Resolution is specified in dots per inch (higher resolution increases the precision of object placements). Type "help epswrite" in Matlab for the full list of options.

For authors preparing manuscripts to aip.org/peerx-press.org, use


to embed Symbol font as their online submission system is not equipped with Symbol font (messes up all TeX characters).

Also, use both epswrite and eps2raster for those of us using pdftex to prepare LaTeX manuscripts for publishers who do not accept PDFs or PNGs. Executing

epswrite fig.eps
eps2raster fig.eps png

creates fig.eps and fig.png. This results in identical images in two formats and, IMO, also results in better quality images than directly printing from Matlab, especially with the antialiasing support of Ghostscript.

The submission logo was also created using this toolbox:

h = text(0,0,sprintf('EPS\nUtility\nToolbox'));
set(gca,'position',[0.1 0 0.8 1]);
axis off
epswrite('logo','Size',[150 100]/200);

Cite As

Kesh Ikuma (2024). EPS Utility Toolbox (https://www.mathworks.com/matlabcentral/fileexchange/35429-eps-utility-toolbox), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Printing and Saving in Help Center and MATLAB Answers

Inspired by: FIXPSLINESTYLE, export_fig

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

v12 - Bug fixes; validated to run with R2014b.

(Minor) bug fix - correctly produce error when EPS file name is not given.

* R2014A compatibility update
* Fixed 'Renderer' option value bug ('painter'->'painters')

Re-uploaded the correct v9 zip file


- bug fixes in epsfixfonts.m & type1subset.m
- separated private/getrscstr.m (generation of DSC Resource header elements)

(v8) Bug fixes

* Added HTML helps in Help browser
* Minor bug fixes

Bug-fix release
* major bug in font embedding
* fixes MATLAB print bug that changes white line markers to black.

* Added epssetbbox.m
* Fixed the bug reported by Jens Munk Hansen
* Option changes in epswrite.m, eps2raster.m, and epssetlinestyle.m

-Removed misplaced file in v4
-Added Units option for epswrite
-Bug fixes
-FEX information update (+logo)

- New functions: epssetbgcolor.m, epscleancolordict.m
- Option enhancements in epswrite, epswrite, & eps2raster
- Bug fixes in eps2raster.m, epsembedfont.m, & epssetlinestyle.m

Added support for embedding of font subsetting (which can substantially reduces EPS file size).

Much thanks go to Ken Sharp on comp.lang.postscript newsgroup to help me sorting out the font subsetting issues.

- Added new functions: epssetup, epsfontpath, epsfontalias, psfontlist, epsgetbbox, epsgetfonts
- Gets postscript fonts directly from MATLAB installation directories.

- Default resolution in epswrite increased to 1000