# Cannot determine size of graphic

I'm trying to include graphics in my Latex-file, which I compiled with latex+dvipdf on OS X. Latex however returns this error: "Cannot determine size of graphic"

My graphic is exported from PowerPoint, so I have tried both .pdf and .png. I get the same errors for both.

Sample code that doesn't work:

\begin{figure}[htb]
\begin{center}
\leavevmode
\includegraphics[width=0.8\textwidth]{graph.png}
\end{center}
\end{figure}


If I have to manually set some measurements of the image, please tell me how I can find out those measurements. I need the image to take up about 80% of text width and be centered. Thanks.

-

The DVI producing latex doesn't support reading the size of PNG, JPG or PDF images. You need to use pdflatex for this. Actually latex is pdflatex in DVI mode in modern distributions, but it can read the sizes only in PDF mode for some reason. You are however able to state the natural size of the images using natwidth and natheight which will make latex compile without error. The produced DVI file will only link to the PDF and the DVI-to-PDF converter will need to include it in the final PDF. AFAIK dvpdf doesn't support this but dvipdfm does.

\documentclass{article}

\usepackage{graphicx}

\begin{document}
\begin{figure}
\centering
\includegraphics[width=0.8\textwidth,natwidth=610,natheight=642]{tiger.pdf}
\end{figure}
\end{document}


Compile with either

pdflatex <file base>


or

latex <file base>
dvipdfm <file base>

-
For dvipdfm(x), one should use dvipdfm or dvipdfmx option of graphicx pacakge, and use extractbb (ebb, xbb) program to produce .bb or .xbb file. bmpsize package can also used to replace extractbb. – Leo Liu May 8 '11 at 15:15