# ADDING white background to an image?

I'm new to beamer and am trying to make a presentation. When inserting an image, the output is satisfactory, except when I try to insert a .pdf! The white layer in the image disappears. Initially, the image was a .ps, so I used ps2pdf14 to convert it to .pdf and then pdfcrop to add the amount of white border I desire. I can convert the .pdf to .png and it works fine, but the quality isn't good enough for big pictures. Is there a way to restore the white layer when inserting the .pdf image? I apologize if this is a trivial question, or if I've simply over looked something.

Here's an example code to illustrate the problem

\documentclass[xcolor=svgnames,mathserif,serif]{beamer}
\usetheme{default}
\setbeamertemplate{frametitle}[default][center]
\definecolor{myblue}{RGB}{47,94,142}
\setbeamercolor{background canvas}{bg=myblue}
\usefonttheme{structuresmallcapsserif}
\setbeamercolor{title}{fg=white}
\setbeamercolor{titlelike}{fg=white}
\setbeamercolor{normal text}{fg=white}
\title{Sample Title}
\author{\large{Me}}
\institute{\small{University}}
\date{\small{Today's Date}}
\begin{document}

\begin{frame}
\titlepage
\end{frame}

\begin{frame}{Sample Title}
\begin{center}
\includegraphics[width=3in]{1.pdf} %why isn't white space appearing?
\end{center}
\end{frame}

\end{document}

-
Welcome to TeX.sx! A tip: You can use backticks  to mark your inline code; also, if you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – henrique Oct 13 '12 at 4:07
I'm not sure what exactly you mean by whitespace (perhaps since we don't have 1.pdf). For example, do you have an image of size (say) 2in by 3in and you want it to have space around it, actually setting to a size of (say) 3in by 4in? – Werner Oct 13 '12 at 4:23
thank you for the tip! – CajunP Oct 13 '12 at 5:59
currently, the .pdf has black text, but the background matches my slide when it should have a white background. yes, I believe that is what I want, Werner. I used the command: pdfcrop --margins 5 sample.pdf sample.pdf to add a small amount of whitespace around the image. I want the image to look like the pdfcropped one. converting to .png works fine, but the .pdf version doesn't – CajunP Oct 13 '12 at 6:06
pdf background is transparent, not white. You can force a white background including it into a colorbox. Something like \colorbox{white}{\includegraphics{1.pdf}}. – Ignasi Oct 13 '12 at 8:16

pdf images has a transparent background, so even with a border, when you include them over a colored background the"white border" disappears. The easiest solution would be to include your figure into a white box with \colorbox{white}{\includegraphics{your-pdf-figure}}. This way figure's background and border are white.

Update: Missing graphic example for the original answer and some rotating examples for lalebarde's comment.

\documentclass[xcolor=svgnames,mathserif,serif]{beamer}
\usetheme{default}
\setbeamertemplate{frametitle}[default][center]
\definecolor{myblue}{RGB}{47,94,142}
\setbeamercolor{background canvas}{bg=myblue}
\usefonttheme{structuresmallcapsserif}
\setbeamercolor{title}{fg=white}
\setbeamercolor{titlelike}{fg=white}
\setbeamercolor{normal text}{fg=white}
\begin{document}

\begin{frame}{Sample Title}
\begin{center}
\includegraphics{1842.pdf} %why isn't white space appearing?
\colorbox{white}{\includegraphics{1842.pdf}}
\end{center}
\end{frame}

\begin{frame}{Sample Title}
\begin{center}
\colorbox{white}{\includegraphics[angle=90]{1842.pdf}}
\colorbox{white}{\includegraphics[angle=30]{1842.pdf}}
\end{center}
\end{frame}

\begin{frame}{Sample Title}
\begin{center}
\rotatebox{30}{\colorbox{white}{\includegraphics{1842.pdf}}}
\rotatebox{-60}{\colorbox{white}{\includegraphics{1842.pdf}}}
\end{center}
\end{frame}
\end{document}


Note: you can get 1842.pdf sources from here

-
If the includegraphics includes a rotation with the angle parameter, it does not work: the part let void by the rotation is still transparent. – lalebarde Jan 20 '15 at 17:27
@lalebarde I'm not sure to understand your comment. Do you want that the figure's border also rotates? – Ignasi Jan 20 '15 at 18:19
@lalebarde After reading again your comment, I think you want a rotatebox instead of angle inside \includegraphics`. Does it solve your problem? – Ignasi Jan 20 '15 at 18:27