# Is it possible to add a white layer below an image? [duplicate]

I am creating a beamer presentation using the beetle color theme (gray background). I am loading eps images that do not have a white background layer and would like to add one. I do not want to edit all the images to add a white layer to image file. How can I add a white layer, with the same size and position, to serve as a background?

## marked as duplicate by Ignasi, Paul Gaborit, Mico, Henri Menke, Tom BombadilNov 11 '15 at 10:35

• Probably with TikZ? Something like \begin{tikzpicture}\node[inner sep=0, fill=white] {\includegraphics{pic.eps}};\end{tikzpicture} – Tom Bombadil Nov 10 '15 at 19:10
• Can you make one of the images available for download and add a link here? – Ian Thompson Nov 10 '15 at 21:48
• An example showing how you are using them would encourage answers. Much easier than starting from scratch and trying to guess. Don't include the extension as @TomBombadil suggests, though. Let LaTeX figure out the extension. That way, if you use pdfLaTeX, it will work and, after the first compilation, LaTeX will automatically use the existing converted file. (Obviously, if you don't use pdfLaTeX, this is less important, but it it best practice not to include the extension unless really necessary.) – cfr Nov 11 '15 at 0:28

Here's the version for TikZ fans like myself:

## Code

\documentclass{beamer}
\usecolortheme{beetle}
\usepackage{tikz}

\begin{document}

\begin{frame}
\begin{tikzpicture}
\node[fill=white] {\includegraphics[scale=1]{cclogo}};
\end{tikzpicture}

\includegraphics[scale=1]{cclogo}
\end{frame}

\end{document}


## Output

• I used this EPS image – Tom Bombadil Nov 11 '15 at 7:51
• I was able to use this to add the white layer. – Steven C. Howell Nov 12 '15 at 1:10
• @stvn66: The white background is a little bigger than the image. To influence this you can use the inner sep key. \node[fill=white, inner sep=0mm] will remove it, and you can also use it to add a border of a defined length. – Tom Bombadil Nov 12 '15 at 7:13

Sorry, but the MWE package doesn't provide any images with transparent backgrounds. BTW, you probably should change the background color to white.

\documentclass{beamer}
\usepackage{xcolor}
\usepackage{graphicx}

\newcommand{\fillgraphics}[2][]% same as \includegraphics
{\bgroup
\sbox0{\includegraphics[#1]{#2}}%
\hbox{\color{red}\rlap{\rule{\wd0}{\ht0}}\box0}
\egroup}

\begin{document}
\begin{frame}
\fillgraphics[width=.9\textwidth]{images/cloud.png}
\end{frame}
\end{document}


• I deleted my answer because it was very similar to yours, but yours is better (simpler, more efficient). +1 – Steven B. Segletes Nov 11 '15 at 5:45
• I can reproduce this using your code but when I replace standalone with beamer then surround the fillgraphics command by \begin{frame}{} and \end{frame}, the colored layer is not aligned with the image. It is above it on the page then followed by the image. – Steven C. Howell Nov 12 '15 at 1:09
• Weird, but correctable. Beamer is a world unto itself. – John Kormylo Nov 12 '15 at 4:13