Extend Beamer frame and inherit arguments (and overlays)

beamerenvironmentsoptional argumentsoverlays

I intend to extend a beamer frame to save some overhead when making slides.

I've followed an answer here after another answer involving NewEnviron didn't work for me. The beamer user guide has some details on re-defining an environment:
enter image description here

So I defined a "pictureframe" to have slide with two columns and a picture in the right column:

\newcommand\startcolumns{\begin{columns}}
\newcommand\stopcolumns{\end{columns}}
\newcommand\startleftcolumn{\begin{column}{0.55\textwidth}}
\newcommand\startrightcolumn{\begin{column}{0.39\textwidth}}
\newcommand\stopcolumn{\end{column}}

\newenvironment{pictureframe}[2]{%
\newcommand\mypic{#2}
\begin{frame}[environment=pictureframe]{#1}
\startcolumns
\startleftcolumn
}{
\stopcolumn
\startrightcolumn
\centering\includegraphics{\mypic}
\stopcolumn
\stopcolumns
\end{frame}
}

Then, I can make a slide like this:

\begin{pictureframe}{Picture Frame}{example-image-a}
    \begin{itemize}
        \item Foo
        \item Bar
    \end{itemize}
\end{pictureframe}

enter image description here

Now, I want to be able to use 1) overlays and 2) labels, i.e.

\begin{pictureframe}<1>[label=picture,noframenumbering]{Picture Frame}{example-image-a}
    \begin{itemize}
        \item Foo
        \item Bar
    \end{itemize}
\end{pictureframe}

However, it doesn't compile:

! LaTeX Error: File `1' not found.

My question is: How do I properly "inherit" the frame environment, so that overlays and optional arguments are passed on, much like with a "real" frame?

Best Answer

Here is an environment overlay specification-aware. But you didn't write what these specifications should be used for (#4)...

The \typeout{...} shows the parameters.

\documentclass{beamer}

\newcommand\startleftcolumn{\column{0.55\textwidth}}
\newcommand\startrightcolumn{\column{0.39\textwidth}}

\newenvironment<>{pictureframe}[3][]{%
  \typeout{1:#1,2:#2,3:#3,4:#4}
  \begin{frame}#4[environment=pictureframe,#1]
    \newcommand\mypic{#3}
    \frametitle{#2}
    \columns
    \startleftcolumn
  }{
    \startrightcolumn
    \centering\includegraphics[width=\linewidth]{\mypic}
    \endcolumns
  \end{frame}
}

\begin{document}
\begin{pictureframe}{Picture Frame}{example-image-a}
  \begin{itemize}
  \item Foo
  \item Bar
  \end{itemize}
\end{pictureframe}

\begin{pictureframe}<1>[label=picture,noframenumbering]{Picture Frame}{example-image-a}
  \begin{itemize}
  \item Foo
  \item Bar
  \end{itemize}
\end{pictureframe}

\end{document}