EPS Utility Toolbox

Version 1.22 (187 KB) by Kesh Ikuma
A set of functions to generate publisher-happy EPS images
4.7K Downloads
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

epswrite('fig.eps','EmbedFont','AddSymbol');

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(h,'VerticalAlignment','bottom','HorizontalAlignment','left','FontWeight','bold');
set(gca,'position',[0.1 0 0.8 1]);
axis off
epswrite('logo','Size',[150 100]/200);
eps2raster('logo','png','resolution',200,'deletesource','on')

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
Categories
Find more on Printing and Saving in Help Center and MATLAB Answers
Acknowledgements

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
1.22

v12 - Bug fixes; validated to run with R2014b.

1.21.0.0

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

1.20.0.0

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

1.18.0.0

Re-uploaded the correct v9 zip file

1.15.0.0

update

1.11.0.0

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

1.10.0.0

(v8) Bug fixes

1.9.0.0

* Added HTML helps in Help browser
* Minor bug fixes

1.8.0.0

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

1.7.0.0

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

1.5.0.0

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

1.4.0.0

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

1.3.0.0

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.

1.2.0.0

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

- Default resolution in epswrite increased to 1000

1.0.0.0