No BoundingBox error message

I want to include an eps file in LaTeX. I typed the following in Texmaker

\begin{document}
\begin{figure}[!ht]
\centering
\includegraphics[scale=1]{figure}
\end{figure}

\end{document}


The error I get is

! LaTeX Error: Cannot determine size of graphic in figure.eps (no BoundingBox).


• Welcome to TeX.SE! What is the filename extension of your graphics file? Is it .eps, or something else? Please advise. – Mico Sep 17 '13 at 19:20
• does you figure have a bounding box (a line like %%BoundingBox: 1 2 3 4) It should have if it is a valid EPS file. – David Carlisle Sep 17 '13 at 19:24
• As @David Carlisle is saying; try opening your figure.eps in a text_editor and search for the word: BoundingBox. If it is not there, then something is wrong. What is the source of your figure? – hpekristiansen Sep 17 '13 at 19:29
• @DavidCarlisle -- we've had problems here in production with the bounding box at the end; maybe it's dvips that can't find it properly, but in any case, we always have to make repairs. so i made an assumption ... – barbara beeton Sep 17 '13 at 21:14
• What do you get with \includegraphics[bb=0 0 100 100]{figure} ? – user2478 Jan 29 '14 at 8:38

Although the question has been answered by @DavidCarlisle in the comment, I'll try to complete the answer here.

This is not supposed to happen for valid eps files, as they should contain a BoundingBox comment and the graphicx package should be able to read it. The error message is typical when including bitmap graphics, e.g. jpg, as explained here.

In case you have a peculiar eps file which contains a BoundingBox comment but, for some reason, graphicx cannot read it, you can try searching your file. Do this either by opening the file in a text editor or by using something like the grep command:

grep BoundingBox figure.eps


You should normally see a line like:

%%BoundingBox: 0 0 30 30


Then, update your \includegraphics by supplying that:

\includegraphics[scale=1,bb=0 0 30 30]{figure}


In case you cannot find a bounding box (and your eps file is still usable, of course, which may not be the case), I'd suggest that you try guessing it. Start, e.g. with bb=0 0 100 100 and see what you get, then try increasing or decreasing the numbers. They are, in turn: lower-left-x (llx), lower-left-y (lly), upper-right-x (urx), and upper-right-y (ury). The width of the picture is urx-llx and the height is ury-lly.

I've had the same error occur too. In my case it turned out that I had a file named figure.eps.pdf, and so the \includegraphics command (which apparently tries to guess the file ending) tried to load that instead of figure.eps. Deleting the file figure.eps.pdf solved my problem.

• This does not seem to be an answer, because it does not explain what you did to resolve the problem. – TeXnician Jan 1 '18 at 16:33
• It does now.... – BlenderBender Jun 10 '18 at 13:36