Problem with \only and alignment of graphics (pdf) in beamer

This is a well known fact; the beamer documentation mentions it in Section 9.5 Dynamically Changing Text or Images:

The trouble with this approach [using the \only command] is that it may lead to slight, but annoying differences in the heights of the lines, which may cause the whole frame to “wobble” from slide to slide. This problem becomes much more severe if the replacement text is several lines long. To solve this problem, you can use two environments: overlayarea and overprint. The first is more flexible, but less user-friendly.

So, you can use an overlayarea:

\documentclass{beamer}

\begin{document}

\begin{frame}
\begin{overlayarea}{\textwidth}{\textheight}
    \only<1>{\includegraphics[width=\textwidth]{test}}
    \only<2>{\includegraphics[width=\textwidth]{test}}
    \only<3>{\includegraphics[width=\textwidth]{test}}
\end{overlayarea}
\end{frame}

\end{document}

This is just the usual issue with whatsit nodes in vertical mode. You see the same using color changes (even without beamer).

If you make sure they come in horizontal mode then everything works out fine.

\documentclass{beamer}

\begin{document}

\begin{frame}
    \mbox{\only<1>{\includegraphics[width=\textwidth]{test}}%
    \only<2>{\includegraphics[width=\textwidth]{test}}%
    \only<3>{\includegraphics[width=\textwidth]{test}}}
\end{frame}

\end{document}

As Roly pointed out, the solution I found worked best was adding a % to the end of all but the last \includegraphics commands (What is the use of percent signs (%) at the end of lines?).

So this works:

\begin{frame}
  \frametitle{Slide 1}
  \begin{figure}[H]
    \centering
    \only<1>{\includegraphics[width=0.7\textwidth]{thinBody/thinBody0.png}}%
    \only<2>{\includegraphics[width=0.7\textwidth]{thinBody/thinBody1.png}}%
    \only<3>{\includegraphics[width=0.7\textwidth]{thinBody/thinBody2.png}}%
    \only<4>{\includegraphics[width=0.7\textwidth]{thinBody/thinBody3.png}}%
    \only<5>{\includegraphics[width=0.7\textwidth]{thinBody/thinBody4.png}}
    \caption{The caption}
    \label{fig:label}
  \end{figure}
\end{frame}

Or for the code in the question:

\begin{frame}
    \only<1>{\includegraphics[width=\textwidth]{test}}%
    \only<2>{\includegraphics[width=\textwidth]{test}}%
    \only<3>{\includegraphics[width=\textwidth]{test}}
\end{frame}

I don't know why this happens, but it works very well. Perhaps someone else could enlighten us.