# No background canvas for plain frame

I created background canvas for my presentation. I don't want the image if the frame style is plain. How can I extend my style file that no background image appears if \begin{frame}[plain] is used.

\setbeamertemplate{background canvas}
{\ifnum\thepage=1\relax%
{%
\includegraphics{Background_page1}
}
\else%
\includegraphics{Background}
\fi%
}


beamer has the boolean beamer@plainframe to decide whether the plain option is activated or not, so you can use it in your conditional installment of the background canvas template:

\documentclass{beamer}
\usetheme{CambridgeUS}

\makeatletter
\setbeamertemplate{background canvas}{%
\ifbeamer@plainframe%
\else
\ifnum\thepage=1\relax%
\includegraphics{example-image-a}%
\else
\includegraphics{example-image-b}%
\fi
\fi
}
\makeatother

\begin{document}

\begin{frame}
\frametitle{A test regular frame}
\end{frame}

\begin{frame}[plain]
\frametitle{A test frame with the \texttt{plain} option}
\end{frame}

\begin{frame}
\frametitle{Another test regular frame}
\end{frame}

\end{document}


The result: