how to fit image to page in latex code example
Example 1: how to fit a whole picture on page in latex
\newlength{\textundbildtextheight}
\newcommand{\textundbild}[2]{
\settototalheight\textundbildtextheight{\vbox{#1}}
#1
\vfill
\begin{center}
\includegraphics[width=\textwidth,keepaspectratio=true,height=\textheight-\the\textundbildtextheight]{#2}
\end{center}
\vfill
}
Example 2: fit image to page latex
\includegraphics[width=\textwidth,height=\textheight,keepaspectratio]{myfig.png}