how to fit a whole picture on page in latex
newlength{textundbildtextheight}
newcommand{textundbild}[2]{
settototalheighttextundbildtextheight{vbox{#1}}
#1
vfill
begin{center}
includegraphics[width=textwidth,keepaspectratio=true,height=textheight-thetextundbildtextheight]{#2}
end{center}
vfill
}