[Tex/LaTex] How to make a block transparent for a background image

backgroundsbeamergraphics

I use the code

\usebackgroundtemplate{
    \centering
        \includegraphics[width=0.5\paperwidth,height=0.5\paperheight]{image.png}
}

to get a background image in a Beamer/Latex presentation. However, blocks, for example, are not transparent (they have white background so that the image can't bee seen). The same is true for the title on the titlepage.

How can I set the blocks/titles such that they are transparent?

Best Answer

You could specify the opacity of your blocks using \addtobeamertemplate:

 \addtobeamertemplate{block begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
 \addtobeamertemplate{block alerted begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
 \addtobeamertemplate{block example begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}

It doesn't work well if you use block shadows though.

Example:

\documentclass[compress]{beamer}
\usecolortheme{rose}

\usebackgroundtemplate{\centering
        \includegraphics[width=\paperwidth,height=\paperheight]{image.png}}

\addtobeamertemplate{block begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
\addtobeamertemplate{block alerted begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}
\addtobeamertemplate{block example begin}{\pgfsetfillopacity{0.5}}{\pgfsetfillopacity{1}}

\begin{document}

  \begin{frame}{}
    \begin{theorem}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. 
    \end{theorem}

  \begin{alertblock}{Alert!!!}
Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
  \end{alertblock}

  \begin{exampleblock}{Example}
Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros.
  \end{exampleblock}
  \end{frame}
\end{document}