tags:

views:

61

answers:

2

I'm in a documentclass in LaTeX. How do I load an image saved as a .png file?

+4  A: 

Use the graphicx package (included in most LaTeX distributions), which lets you:

\includegraphics[width=3in]{foo.png}

See an example page to get you started.

Seth Johnson
+6  A: 

If you work with pdflatex (direct compilation to pdf), you can use the graphicx package using the \includegraphics command. If your image is called foo.png, you can add the following command inside your document.

\includegraphics{foo}

However, if you work with latex (compilation into dvi first), you cannot use 'png' file as image (with any package). You have to convert your image into 'eps' first. If your image is called foo.png, then you can convert it with any graphics software into foo.eps, and use the following command to include the image.

\includegraphics{foo}

Here is a complete example with width specification:

\documentclass{article}
\usepackage{graphicx}

\begin{document}
Here is my image.
\includegraphics[width=\textwidth]{foo}
\end{document}
Lohrun