[Tex/LaTex] Trouble using an image in a Beamer presentation

beamererrorsgraphicspdftex

I'm trying to include an image in my Beamer presentation, but I keep getting this error:

!pdfTeX error: /usr/local/texlive/bin/i386-linux/pdflatex (file
./markov.jpeg): reading JPEG image failed (no JPEG header found)

As per the template given on writelatex.com, I'm using the following code to install the image:

\begin{figure}
    \includegraphics{markov.jpeg}
    \caption{\label{fig 1:}Repeated Iteration of Markov Matrix}
\end{figure}

Best Answer

The error message means that the file markov.jpeg is not really a .jpeg-file. The fact that it opens fine in the browser does not mean much (if the browser fails to load it as jpeg, it tries using other supported formats to decode it).

To fix the problem, open it with a more or less advanced image editing/viewing progam (Gimp, MS Paint, Picasa, MS Office Picture Manager, Windows Live Photo Gallery or Photoshop to name a few), and use the export command to create a new .jpeg file.