[Tex/LaTex] Tight bounding box for EPS

epspsfrag

This is a follow-up of the question https://tex.stackexchange.com/questions/14402/eps-file-with-tight-bb-psfrag-labels.

I have this file named model.eps (see further below on how to get the file) and I am replacing the labels on the figure using psfrag commands. If I compile the file test3.tex using latex > dvips > ps2pdf, the resulting file is well-cropped and is the same as the size of the file model.eps. I am using the standalone package.

However I would like an EPS file instead of a PDF file. With dvips I can get a PS file. I tried the command:

dvips -D7200 -E test3.dvi -o test3.ps

making sure to use the -E switch in order to get a tight bounding box.

The resulting PS file (test3.ps) is not properly tight bounded on the left as you can see.

What am I doing wrong and how can I correct this fault?

All the files are in the folder tightbounding here at
http://petitlien.fr/my_test_file.

Thank you for any suggestions…

—-
Update

Running epstool:

E:\new>epstool --bbox --copy test3.ps outfile.eps

DSC Information

At line 9033:
                     <xapGImg:image>/9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9w
IDMuMAA4QklNA+0AAAAAABAASAAAAAEA&#xA;AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQ
EBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK&#xA;DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx
8fHx8fHwEHBwcNDA0YE

Lines in DSC documents must be shorter than 255 characters.

"C:\Program Files\gs\gs9.01\bin\gswin32c.exe"  -dNOPAUSE -dBATCH -sDEVICE=bbox
 -c "<</PageSize [9400 9400] /PageOffset [3000 3000]>> setpagedevice" -f "c:\doc
ume~1\yogcal\locals~1\temp\gsviewa01924"
GPL Ghostscript 9.01 (2011-02-07)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
%%BoundingBox: 0 0 0 0
%%HiResBoundingBox: 0.000000 0.000000 0.000000 0.000000
OK

I'm getting the bounding box as 0 0 0 0. Why?

Best Answer

install the program epstool, available for Windows and Linux and then run

epstool --bbox --copy infile.eps outfile.eps

then outfile.eps should have a correct bounding box.