2012-03-06

latex error "image failed (no JPEG header found)"

i use texmaker to write latex documents on windows.  i wanted to insert a graphic using the directions on this page.  i got these errors:

!pdfTeX error: pdflatex (file C:/.../dog.jpg): reading JPEGimage failed (no JPEG header found)==> Fatal error occurred, no output PDF file produced!
i created the jpg file in microsoft paint.  perhaps if i used a different jpeg, it would've worked.

the solution is to open the jpg file in paint, save it as a .png file and then use the png file.

no need to change the latex code if it doesn't include a file extension.  e.g.

\includegraphics{dog}
otherwise, just change the filename.  change
\includegraphics{dog.jpg}
to
\includegraphics{dog.png}

7 comments: