# Is there anything wrong including this png? [duplicate]

I'm writing a document (article class), and I'm including some png graphics, this is the code that includes them (it's a subimage environment):

\begin{center}
\begin{figure}
\centering
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[natwidth=512px,natheight=511px,width=4cm,height=4cm]{param.png}
\caption{img1}
\label{img1}
\end{subfigure}%
~ %add desired spacing between images, e. g. ~, \quad, \qquad, \hfill etc.
%(or a blank line to force the subfigure onto a new line)
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[natwidth=512px,natheight=511px,width=4cm,height=4cm]{crtpnt.png}
\caption{img2}
\label{fig:img2}
\end{subfigure}
~ %add desired spacing between images, e. g. ~, \quad, \qquad, \hfill etc.
%(or a blank line to force the subfigure onto a new line)
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[natwidth=512px,natheight=511px,width=4cm,height=4cm]{ferro.png}
\caption{img3}
\label{fig:img3}
\end{subfigure}
\caption[prueba]{\label{fig:images}caption}\end{figure}\end{center}


I'm compiling through latex and then dvipdf to get a pdf. Firt of all, if I compile with pdflatex it works perfectly, but I would like to compile with an intermediate dvi file. When running Latex the dvi file is alright, although images don't show up. If I run then the dvipdf, it cuts the document up to the page in which the previous snippet is, not showing the images, or anything else beyond them.

I have previous images in eps format which are perfectly included. Is the way I'm including png graphics right? Am I doing anything wrong?

• Nope, it's not right. You can't use .png files with latex. The pdflatex runs were successfull, as you wrote. Either use the .eps version or pdflatex – user31729 Apr 26 '15 at 11:30
• @ChristianHupfer Ok, I will just transform them all to eps format. I was reading some questions like tex.stackexchange.com/questions/94869/… aand it was said that latex just needed to know the natural size of the image... So I thought I could use png images – MyUserIsThis Apr 26 '15 at 11:34
• If you can directly generate the .eps files it would be much better than using a pixel format such as png – user31729 Apr 26 '15 at 11:36
• I just used ImageMagick, I did convert file.png file.eps and it worked perfectly. They're very simple images graphically, so I guess any problem I could have producing vector images dissappears. – MyUserIsThis Apr 26 '15 at 11:37
• unrelated but the \begin{center} outside the figure is wrong, it doesn't affect the alignment, just adds spurious vertical space. Also  ~  is a slightly odd way to specify a space of three word spaces, and it relies on 6 word spaces being less than .1\textwidth. – David Carlisle Apr 26 '15 at 11:39