LaTeX error: File `figure.png' not found (\includegraphics)
\includegraphics{name} looks for the image relative to the main .tex file (and any folders listed in \graphicspath). If the exact name is not there, pdfTeX stops.
! Package pdftex.def Error: File `figure.png' not found: using draft setting.
Try it: this example has the error
Edit the example using the steps below, then press Compile. What pdfTeX printed for it:
! Package pdftex.def Error: File `figure.png' not found: using draft setting.
See the pdftex.def package documentation for explanation.
Type H <return> for immediate help.
...
l.4 \includegraphics[width=3cm]{figure.png}
Ready. Press Compile (or Ctrl/Cmd + Enter).
Common causes
- The image is in a subfolder, but the path in
\includegraphicsdoes not say so. - Case or extension mismatch:
Figure.PNGon disk,figure.pngin the source. Linux and Overleaf are case-sensitive. - The image was never uploaded to the online editor, or was renamed.
- A format pdfLaTeX cannot read, such as
.epswithout conversion, or.svg.
How to fix it
- Use the path relative to the main file:
\includegraphics{figures/plot.png}, or set\graphicspath{{figures/}}. - Match the file name exactly, including case and extension.
- In TeXpad, drop the image into the Figures panel; the Overleaf import brings figures along and resolves
\graphicspath. - Convert EPS or SVG to PDF or PNG for pdfLaTeX.
The fixed example
\documentclass{article}
\usepackage{graphicx}
\begin{document}
% upload figure.png, then: \includegraphics[width=3cm]{figure.png}
\fbox{\parbox[c][2cm][c]{3cm}{\centering figure.png goes here}}
\end{document}