# problem when inserting figure: "dfTeX error: pdflatex (file ./billeder/Metodeteori/nmr_spectra_ny.png): libpng: internal error"

When I insert a figure in LaTex I get this error:

dfTeX error: pdflatex (file ./billeder/Metodeteori/nmr_spectra_ny.png): libpng: internal error.

I have checked that the file is correctly uploaded, in the right format, and that it is written correctly in the figure-code (shown below). I have uploaded more than 20 figures before this one, and it is done exactly the same way, so there should not be a problem - but suddenly it is a problem and no PDF is shown. I know the problem lies in this particular figure, as the errors disappear and the PDF comes back when I delete the figure. I have already tried re-uploading the figure in different formats, renaming it, writing the figure-code again but nothing works for me. I have tried google and LaTex' own guides but I cannot find the answer I need.

This is the code for the figure:

\begin{figure}[H]
\centering
\includegraphics[width=8cm]{billeder/Metodeteori/nmr_spectra_ny.png}
\caption{Cool caption \cite{FID}.}
\label{fig:NMR_spectra}
\end{figure}


Note: The text-source in the figure has been used many times before the figure and works perfectly, so the error in not found there.

This is some of the packages:

\usepackage{graphicx}

\usepackage[dvipsnames]{xcolor}

\usepackage{flafter}

\usepackage{float}

\let\newfloat\relax

This has not been a problem for me previously in my use of LaTex (neither in this project or previous projects) and therefore, I do not know how to solve it. Can anyone help me fix the problem? In am not sure what information is necessary, so please let me know if more is needed.

• Hi and welcome to TeX.SE, @Celilie, Please read about MWEs. What packages and classes are you using? For example, are you using graphicx? Have you tried to remove/comment some previous figure and the one with problem suddenly worked? You issue may be related with Too many unprocessed floats.