image thumbnail

EPS Utility Toolbox

version 1.22 (187 KB) by Kesh Ikuma
A set of functions to generate publisher-happy EPS images

4.5K 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 (2021). 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
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!