[Tex/LaTex] Automatically scale big and small graphics for beamer presentations

beamergraphics

For the next few semesters I'll be making a lot of beamer presentations with a lot slides that are just a frame title and a figure. I am trying to make a command to make a lot faster to code and easier to read. Here is my first attempt:

\usepackage{graphicx}

\newcommand {\framedgraphic}[2] {
\begin{frame}{#1}
    \begin{figure}
        \begin{center}
            \includegraphics{#2}
        \end{center}
    \end{figure}
\end{frame}
}

In this past I've have scaled manually with something like

\includegraphics[height=0.7\textheight]{table3a.png}

Through trial and error I have to find the right scaling to make the figure fill the slide. Is there a way I can automatically do this scaling without adding more arguments to my command? Including covering both wide and tall figures? Thanks!

BTW, here I'm using graphicx but I'm not really wed to it. I am just getting started in TeX and would love to learn any new ways of thinking of this problem.

Best Answer

Martin's comment had the fix. Here's what I'm using:

\newcommand {\framedgraphic}[2] {
    \begin{frame}{#1}
        \begin{center}
            \includegraphics[width=\textwidth,height=0.8\textheight,keepaspectratio]{#2}
        \end{center}
    \end{frame}
}