24

In my presentation using Beamer, I want to use some image say village/river as a back ground in some slides. However I will write something in these slides also.

How can I do this?

  • Suppose I want to use african village (google image) as a back ground in some of my slides. But then written documents will be unclear. How one can convert the image as a water marking? – user12290 Oct 21 '12 at 0:04
  • 1
    You can use opacity. See my answer below. – user11232 Oct 21 '12 at 0:55
25

You can also use \setbeamertemplate{background} {\includegraphics[width=\paperwidth,height=\paperheight,keepaspectratio]{background.jpg}} (where background.jpg is your picture).

A sample background:

enter image description here

Code

\documentclass{beamer}
\setbeamertemplate{background}
{\includegraphics[width=\paperwidth,height=\paperheight,keepaspectratio]{background.jpg}}


\begin{document}

\begin{frame}

\begin{exampleblock}{Test}
\begin{itemize}
\item First item.
\end{itemize}
\end{exampleblock}

\end{frame}

\end{document}

enter image description here

Edit

To answer the comment by the OP

Suppose I want to use african village (google image) as a back ground in some of my slides. But then written documents will be unclear. How one can convert the image as a water marking?

Here one can use the opacity option provided by tikz as

\setbeamertemplate{background canvas}{\begin{tikzpicture}\node[opacity=.1]{\includegraphics [width=\paperwidth]{example-image.pdf}};\end{tikzpicture}}

One can change the opacity values from 0 to 1 as per demand.

The code:

\documentclass{beamer}
\usepackage{tikz}
\setbeamertemplate{background canvas}{\begin{tikzpicture}\node[opacity=.1]{\includegraphics
[width=\paperwidth]{example-image.pdf}};\end{tikzpicture}} % only for the image: http://ctan.org/pkg/mwe
%      \setbeamertemplate{background}{\includegraphics[width=\paperwidth]{example-image.pdf}}
\begin{document}
\begin{frame}{Testing Background Image}
    Hello!
\end{frame}
\end{document}

enter image description here

  • And how to change the background image in different slides? – Leosar May 3 '17 at 18:15
12

Checking the beamer manual for background reveals the background canvas template:

The template is inserted “behind everything.” The template should typically be some TeX commands that produce a rectangle of height \paperheight and width \paperwidth.

\setbeamertemplate{background canvas}{<your code>}

<your code> can be an \includegraphics that is resized with width= or height=.
Since the exemplary image is already in an aspect ratio of 4:3, it suffices to only give one of these variables.

There is also the background template that is described by the manual, too:

The template is inserted “behind everything, but on top of the background canvas.” Use it for pictures or grids or anything that does not necessarily fill the whole background.


I did not see any difference between those two templates, so the following lines produced the same output:

\setbeamertemplate{background canvas}{\includegraphics[width=\paperwidth]{example-image.pdf}}
\setbeamertemplate{background}{\includegraphics[width=\paperwidth]{example-image.pdf}}

If you insert a more complex background (e.g. composed of a grid of images, background image only in one corner of the slides, …), you are better off using background instead of background canvas.

Code

\documentclass{beamer}
\setbeamertemplate{background canvas}{\includegraphics[width=\paperwidth]{example-image.pdf}} % only for the image: http://ctan.org/pkg/mwe
%      \setbeamertemplate{background}{\includegraphics[width=\paperwidth]{example-image.pdf}}
\begin{document}
\begin{frame}{Testing Background Image}
    Hello!
\end{frame}
\end{document}

Output

enter image description here

3

There is a difference if you do have background (eg. from the template):

\setbeamertemplate{background}{
  \begin{tikzpicture}
    \node[opacity=.3,inner sep=0pt]{
     \includegraphics [height=\paperheight]{example-image.pdf}};
  \end{tikzpicture}
}

will overlay the image on the existing background.

3

Answering the comment:

And how to change the background image in different slides?

Once you want your background to vary from one frame to the other, you could simply use background locally for each frame, starting from how people do the background here,

\documentclass[aspectratio=43]{beamer}
\begin{document}

{%by putting curely bracket here I start my block
%defining background locally
\setbeamertemplate{background}
{\includegraphics[width = \the\paperwidth , height = \the\paperheight{camel}}

%first frame 
\begin{frame}{first background} 
\end{frame}
%second frame
\begin{frame} {first background is still shown here}
\end{frame}
}% I end my block so background is not applied to the next frames 

{
\setbeamertemplate{background}
{\includegraphics[width = \the\paperwidth, height = \the\paperheight]{lion}}

\begin{frame}{Second background}
\end{frame}
}

\begin{frame}{Here I have no picture in background} 
\end{frame}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.