3.0

3.0 | 1 rating Rate this file 12 Downloads (last 30 days) File Size: 1.89 KB File ID: #18681
image thumbnail

Fix bounding box in MATLAB exported encapsulated postscript (.eps) files

by Nathan Tomlin

 

09 Feb 2008 (Updated 11 Feb 2008)

Tweak bounding box (excess space) from matlab exported encapsulated postscript files (.eps)

| Watch this File

File Information
Description

I found that the bounding box on matlab exported eps files was too large on the left and right side. This script just reads in the .eps file and reduces the bbox.

% matlab seems to compute a bounding box on eps files which is too
% large in the x-direction
%
% this script fixes the bounding box.
% it is 99% stolen from fixeps.m, located here:
% http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=4818&objectType=file
% the only change is that this actually changes the bbox numbers
% seriously, the only change is the addition of lines 19,20,31,32
%
% boundingbox has form of:
% %%BoundingBox: x1 y1 x2 y2
% where (x1,y1) is lower-left and (x2,y2) is upper-right
%
% matlab computes x1 too small and x2 too large

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Remove Space in MATLAB Exported Postscript File

MATLAB release MATLAB 7.1.0 (R14SP3)
Other requirements only tested on win xp
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
10 Sep 2008 Mark Tschopp

This script works fine. I immediately modified the function inputs to allow the user to enter the bounding box movements (instead of hard coding it into the function).

It would be nice if the function automatically detected white space and minimized the bounding box accordingly, though.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
graphics import Nathan Tomlin 22 Oct 2008 09:47:06
graphics export Nathan Tomlin 22 Oct 2008 09:47:06
encapsulated postscript eps extra space bounding box tight Nathan Tomlin 22 Oct 2008 09:47:06

Contact us at files@mathworks.com