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 am getting the following error while compiling my Latex File :
! LaTeX Error: Cannot determine size of graphic in tree.jpg (no BoundingBox).
Why do I get this error ? What has this to do with an .eps file ?
In fact, I could compile it fine with MacTex on my machine. But when I submit it online to a scientific journal for publication, it compiles it on the server and sends me the resultant PDF which has all these errors that prevent it from compiling.
I am using the following syntax for including the images :
\begin{figure}[!h]
\begin{center}
\scalebox{0.45}{
\includegraphics{tree.jpg}}
\end{center}
\caption{\small A sample}
\label{tree}
\end{figure}
What should I do ? Could it be that their server is using an old compiler ?
UPDATE : It finally worked. I converted the first image to PDF and the compilation happened perfectly. I guess it used the bounding box value from that PDF and applied it to all images.
Mr Lister
45.5k15 gold badges108 silver badges150 bronze badges
asked Apr 8, 2009 at 21:29
8
To include png and jpg, you need to specify the Bounding Box explicitly.
\includegraphics[bb=0 0 1280 960]{images/some_image.png}
Where 1280 and 960 are respectively width and height.
answered Aug 23, 2011 at 3:34
h3xStreamh3xStream
6,2932 gold badges47 silver badges57 bronze badges
2
I’ve had the same problems including jpegs in LaTeX. The engine isn’t really built to gather all the necessary size and scale information from JPGs. It is often better to take the JPEG and convert it into a PDF (on a mac) or EPS (on a PC). GraphicsConvertor on a mac will do that for you easily. Whereas a PDF includes DPI and size, a JPEG has only a size in terms of pixels.
( I know this is not the answer you wanted, but it’s probably better to give them EPS/PDF that they can use than to worry about what happens when they try to scale your JPG).
answered Apr 8, 2009 at 21:31
UriUri
88.5k51 gold badges221 silver badges321 bronze badges
11
Using .jpg files do not forget about compiling directly to .pdf (pdflatex) and use:
graphicx package with pdftex option (\usepackage[pdftex]{graphicx}).
answered Jul 1, 2011 at 11:21
kuszikuszi
2,06929 silver badges36 bronze badges
3
If you have Gimp, I saw that exporting the image in .eps format would do the job.
answered Apr 25, 2010 at 0:09
balaurbalaur
961 silver badge4 bronze badges
I use MacTex, and my editor is TexShop. It probably has to do with what compiler you are using. When I use pdftex, the command:
\includegraphics[height=60mm, width=100mm]{number2.png}
works fine, but when I use «Tex and Ghostscript», I get the same error as you, about not being able to get the size information. Use pdftex.
Incidentally, you can change this in TexShop from the «Typeset» menu.
Hope this helps.
answered Apr 8, 2009 at 21:45
TomTom
21.5k6 gold badges39 silver badges44 bronze badges
2
On a Mac (pdftex) I managed to include a png file simply with
\includegraphics[width=1.2\textwidth]{filename.png}
. But in order for that to work I had to comment out the following 2 packages:
%\usepackage[dvips]{epsfig}
%\usepackage[dvips]{graphicx}
…and simply use package graphicx:
\usepackage{graphicx}
It seems [dvips]
is problematic when used with pdftex.
answered Jun 15, 2013 at 17:22
1
I had the same problem, caused by a clash between the graphicx
package and an inclusion of the epsfig
package that survived the ages…
Please check that there is no inclusion of epsfig
, it is deprecated.
answered Mar 20, 2013 at 13:01
TommyTommy
7398 silver badges24 bronze badges
Hello,
I can include eps figures in my document, but I have most of my graphics in png format. When I want to include a png figure I get the following message:
! LaTeX Error: Cannot determine size of graphic in fig/BrochierCie_Maroc/fig2.png (no BoundingBox).
this is strange, because if I extract the bounding box with the «ebb» command I get something:
timbrochier$ ebb -v fig2.png
./fig2.png looks like a PNG file…okay
Writing to fig2.bb: Bounding box: 0 0 576 432
… then it looks like if there were a bounding box…?!
I can include this figure but I have to convert it to eps first (with the «convert» command), then there is no problem, but I’m afraid the final pdf will be too heavy if I convert all my graphics to eps… does someone knows how to fix this problem of bounding box, or tell me if i’m doing something wrong?
I’m on Mac OS 10.4, with Texshop.
here are the packages I use:
\documentclass[phd, index, hyperref, prelimtm]{theseUL1_2} % Pour les Phd, remplacer «msc» par «phd»
\usepackage[latin1]{inputenc} % Pour pouvoir taper les accent directement et non pas passer par \’
\usepackage[francais]{babel}
\FrenchItemizeSpacingfalse
\usepackage{epsfig} % Pour utiliser la commande \epsfig
\usepackage{graphicx} % Pour utiliser la commande \includegraphics
\usepackage{textcomp}
and I include my graphics this way:
\begin{figure}[!h]
\begin{center}
\includegraphics[width=12cm]{fig/BrochierCie_Maroc/fig2.png}
\caption{\label{Fig2_BroMaroc}\textsl{ legend of the figure }}
\end{center}
\end{figure}
Thanks for any help!
You need to run pdflatex and not latex, latex does not support anything other than eps.
Related videos on Youtube
01 : 52
Solving pdf view problem in latex
04 : 46
[Latex] How to enable Pdf Viewer in Texmaker & create a Latex document | Math Channel
04 : 37
LaTeX insert pictures, captions and referencing
00 : 45
[Updated for Overleaf V2] Converting a LaTeX-generated PDF to PNG on Overleaf
08 : 32
Week 3 Latex Tutorial Lecture 001 Insert Images Width Scaling Options
Comments
-
I am using Windows x64 bit , Texmaker 5.0.3 , basic miktex 2.9.6850 and when I compile this code, I mean when I run ‘LaTeX’:
\documentclass[twocolumn,prl,nobalancelastpage,aps,10pt]{revtex4-1} %\documentclass[rmp,preprint]{revtex4-1} \usepackage[latin9]{inputenc} \usepackage[english]{babel} \usepackage{graphicx,bm,times} \graphicspath{ {C:/Varie/UNI/MANO/I-semestre-2018/fraboni/esperimenti/RT/pictures/} } \begin{document}
…
\includegraphics{apparatus.pdf}
I get this error both with png and pdf formati file:
! LaTeX Error: Cannot determine size of graphic in C:/Varie/UNI/MANO/I-semestre
-2018/fraboni/esperimenti/RT/pictures/apparatus.pdf (no BoundingBox).I saw other answer here but I could not solve it.
-
What exactly are you running here? It sounds like you’re running latex and not pdflatex. Try the latter.
-
I am running LaTeX
-
You need to run pdflatex, latex does noget support anything other than eps
-
@daleif I love you thank you very much. now it works
-
-
I am running pdflatex. Still I get the error: ! LaTeX Error: Cannot determine size of graphic in sismo.jpg (no BoundingBox).
-
what if I am using overleaf and get the same error?
Recents
I am using Overleaf and must use LaTeX compiler. This is because I use pst-poker
which only works with LaTeX or XeLaTeX and want to submit to arXiv which does not accepts XeLaTeX.)
I have several images in formats JPG and PNG. Compiling the paper with XeLaTeX produces no errors, however when switching to the LaTeX compiler each image produces this «No Bounding Box» error.
I saw I need to determine the bounding box this way:
\includegraphics[width=0.8\linewdith,bb=0 0 100 100]{figurefile}
However it does not work, the PDF it produces contains only the 2 pages before the first image appears.
Problem:
LaTeX-Compiler can’t determine the graphic-size, because there is no
such information in the graphics-file.Error messages like: “Cannot determine size of graphic (no
BoundingBox)”
I have tried:
-
Use a graphic file format, which saves picture-size information, e.g. EPS
.eps
is too large, exceeds the size limit of arXiv
-
Use the PdfLaTeX compiler instead of the LaTeX compiler
- Can’t use PdfLaTeX since it is not compatible with
pst-poker
.
- Can’t use PdfLaTeX since it is not compatible with
-
Specify the picture size manually:
\includegraphics[scale=0.75, natwidth=640, natheight=480]{picture.jpg}
- Does not work, I get a white box, no image.
On a similar question someone answered that LaTeX does not support anything other than EPS. — Is that right?
EDIT:
I need the pst-poker
package to draw cards symbols as the paper is about a card game.