# Trouble Including .png file using graphicx

I'm using MikTex 2.9 and TeXstudio to write up a little report, and I've hit a bit of a snag when trying to include relevant figures. I've specified the correct path to the file directory using \graphicspath, but when I try to add the file itself with \includegraphics, I run into the same roadblock when I try to compile the file. I keep getting the following error message:

Package pdftex.def Error: File figure1.png' not found \includegraphics{figure1.png}


Here's the exact code I've used at the beginning:

\documentclass{article}
\usepackage{graphicx}
\graphicspath{ {F:/UCSB/TeX Files/Brownian Particles/} }
\setlength{\parskip}{1em}
\begin{document}


Most of the document itself is just text, until I try to add the image with

\includegraphics{figure1.png}


I've been researching this problem and I can't find where I'm stuck. The file type shouldn't be a problem as Texstudio should be using pdfLaTeX.

I know the answer is right in front of me, otherwise it should be working already. Any help pointing me in the right direction would be much appreciated.

• Could you provide a snapshot of the code you used? – Romain Picot Jan 20 '16 at 7:44
• How can we reproduce your problem? – Werner Jan 20 '16 at 7:48
• the usual reason for tex not finding the file is that it isn't there, or TeX's been told to look in the wrong place. What is the actual system path to the file, and what does TEXINPUTS and \graphicspath say? – David Carlisle Jan 20 '16 at 7:49
• Pardon me. I've edited the post to include the exact code I've used. The file certainly exists where I've told TeX to look, unless I'm not exactly telling it to look where I think I'm telling it to look. – Oliver Knitter Jan 20 '16 at 7:58
• Try adding \usepackage{grffile} – egreg Jan 20 '16 at 8:09

## Same folder

If it's not a problem for you, you can simply place the graphic file in the same directory as your .tex file, and then call it like

\includegraphics{figure1}


Note that the file extension is omitted in this case. You also don't need to specify the path.

## Subfolder

Alternatively, you can create a subfolder, for example Images, and place all the various images there: .png, .jpg, etc. The extension can be omitted in this case too. The folder structure should be like this:

Main folder
|---- <file>.tex
|
|---- Images
|---- file1.png
|---- file2.jpg


In that case, you would call them:

\documentclass{article}
\usepackage{graphicx}

\graphicspath{{Images/}}

\begin{document}
\includegraphics{file1}
\end{document}
`