# Add a textbox overtop an image in a beamer slide

I have a slide with a figure in it. I want show a vertically and horizontally centered (relative to the image if possible) text box overtop of it as an overlay which will contain a few lines of text.

\documentclass{beamer}
\usepackage[T1]{fontenc}

\begin{document}

\begin{frame}
\frametitle{ESR1}

\begin{center}
Functional analysis
\end{center}

\begin{center}
\includegraphics[width=1\textwidth]{some_image.jpg}
\end{center}
\end{frame}
\end{document}

-

Basically, the same solution as in your last question works: just put the image inside a TikZ node and you can position anything on top of it wherever you want.

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{tikz}

\begin{document}

\begin{frame}
\frametitle{\emph{Mycena interrupta}}

\begin{center}
Known as the Pixies' parasol.
\end{center}

\begin{center}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=1\textheight]{some_image.jpg}};
\node[align=center,red,font={\Huge\bfseries}] at (image.center) {Do NOT eat\\these!};
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}


(Actually, I have no idea whether they are dangerous; the Wikipedia article is rather short and I don't know anything about mushrooms ­­­­— this was just the first nice picture I found on Wikimedia Commons.)

Image attribution: Wikimedia Commons, JJ Harrison.

-
+1 for the mushroom fact disclaimer lol – aeroNotAuto Mar 6 '12 at 16:48

I use the casper image just for a trivial purpose.

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{pstricks}

\newdimen\ImageW
\ImageW=8cm

\newdimen\ImageH
\ImageH=6cm

\fboxrule=0pt
\begin{document}

\begin{frame}[t]{ESR1}

\begin{center}
Functional analysis
\end{center}

\begin{center}
\pspicture(\ImageW,\ImageH)
\rput(0.5\ImageW,0.5\ImageH){\includegraphics[width=\ImageW]{CasperFunny}}
\rput[c](0.5\ImageW,0.75\ImageH)%
{\fbox{\parbox{6cm}{\color{red}\Huge\bf\centering la la la la la! Casper the friendly ghost}}}
\endpspicture
\end{center}

\end{frame}
\end{document}

-