Fading out slides in latex-beamer with the option “handout” produces empty slides

I want to fade out some slides with overlays in the handout of my latex-beamer-presentation. When I use following code, slide one appears in the handout as a empty slide (only with heading). How can I avoid this?

\only<1| handout:0>{Test}
\only<2| handout:2>{\includegraphics[width=.6\textwidth]{foo.jpg}}

• In handout mode, beamer basically collapses all steps of an animation into one. If you explicitly give handout overlay specs, this adds frames in handout mode. To constrain this, just pass an additional overlay spec (<handout:2>) to the frameenvironment. – Daniel Aug 16 '13 at 9:31
• Wolfgang, I have turned my comment into an answer. Please consider upvoting and accepting the answer (by clicking on the green checkmark), this is the way to indicate for other users that this did help you. – Daniel Aug 19 '13 at 15:10
• Welcome to TeX.SX! Usually, we don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you. – jub0bs Aug 19 '13 at 15:16

In handout mode, beamer tries to combine all steps of an animation into one sline. If you explicitly give <handout:xxx> overlay specs, this does add frames in handout mode. To constrain this, just pass an additional overlay spec (<handout:2>) to the frame environment:

\begin{frame}<handout:2>[t]{Frame}
\only<1| handout:0>{Test}
\only<2| handout:2>{\includegraphics[width=.6\textwidth]{foo.jpg}}
\end{frame}


If you have complex frames with many overlay specifications, it can become a bit tedious to specify them twice – especially, if you don't know in the beginning, which parts of the animation should become distinct slides in handout mode. In such cases, I usually specify all overlays as <all:xxx>, so that each step of an animation would also be there in handout mode and just constrain them by the frame's overlay specification:

\begin{frame}<handout:2>[t]{Frame}
\only<all:1>{Test}
\only<all:2>{\includegraphics[width=.6\textwidth]{foo.jpg}}
\end{frame}


Complete MWE:

\documentclass[handout,draft]{beamer}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\begin{document}

\begin{frame}<handout:2>[t]{Frame}
\only<1| handout:0>{Test}
\only<2| handout:2>{\includegraphics[width=.6\textwidth]{foo.jpg}}
\end{frame}

\begin{frame}<handout:2>[t]{Frame}
\only<all:1>{Test}
\only<all:2>{\includegraphics[width=.6\textwidth]{foo.jpg}}
\end{frame}

\end{document}