# Polaroid photo effect in tikz

Is there any way to make a polaroid photo effect in TikZ? I am thinking of something like this

A computer font as the caption might be better in fact but I couldn't find a suitable example online.

I think what is needed is a nice shadow effect outer box, the image placed inside it, a way to do the caption suitably and then for the whole thing to be rotated. I found a few related looking answer but I have no idea how to put them together or if they are suitable. For example, Translate and rotate an object in TikZ (2D) and Faded drop-shadow using tikz-based rounded rectangle? .

My beginning attempt doesn't use TikZ at all and is

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{default}
\usepackage[font=small,skip=0pt]{caption}
\usepackage{lmodern}

\begin{document}
\begin{frame}
\begin{figure}[ht]
\tiny{Hello world!}
}\end{minipage}},rotate=-5,center}
\includegraphics[width=2cm]{face}%
\end{figure}
\end{frame}
\end{document}


This gives

-
Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – Christian Hupfer Aug 6 '14 at 9:43
Oh! Aishwarya Rai in TeX.SX. :-) – Harish Kumar Aug 6 '14 at 9:50
@ChristianHupfer Thanks. You are right. I have never used TikZ except by copy and pasting to be honest but I will do my best. – Lembik Aug 6 '14 at 9:57

Something like this

Description: I defined a command \polaroid, taking five arguments, the first being optional, designed for the tcolorbox only.

• 1st arg: tcolorbox settings
• 2nd arg: Rotation angle in degrees
• 3rd arg: Scaling of the image
• 4th arg: Image file name
• 5th arg: Caption

The shadow is blurred now, the detailed settings depend on the personal request and can not be done here, change the fuzzy shadow option values at will.

\documentclass[paper=a4,12pt]{scrartcl}%

\usepackage{tcolorbox}%
\usepackage{etoolbox}%

\tcbuselibrary{skins}%

\begin{document}%

\tcbset{enhanced}
\rotatebox{#2}{%
\begin{tcolorbox}[#1]
\begin{center}%
\setlength{\fboxrule}{0.2pt}%
\setlength{\fboxsep}{0pt}%
\fbox{%
\includegraphics[scale=#3]{#4}}

#5%
\end{center}%
\end{tcolorbox}%
}%
}%

\polaroid{-10}{0.25}{face}{\Large \textsf{\textbf{Hello World!}}}%

\end{document}


Old version

\documentclass[paper=a4,12pt]{scrartcl}

\usepackage{tcolorbox}%
\usepackage{etoolbox}%

\begin{document}%

\begin{center}
\includegraphics[scale=0.5]{bild_erwin_schroedinger}

\Huge Hello World%
\end{center}
\end{tcolorbox}
}%

\end{document}


About the jaggy lines issue: Adding a tight \fbox around the image overprints the lines, but it is only a work around.

Admitted, Erwin Schrödinger is not as sexy as that actress ;-)

-
You made a mistake. There are not enough stars to spell brainy. – Lembik Aug 6 '14 at 10:13
Erwin is very aishwary in that foto though – percusse Aug 6 '14 at 10:37
@eleanora: I meant sexy, not brainy :D :D – Christian Hupfer Aug 6 '14 at 10:39
@eleanora: The only jaggy part is the image itself, since it's a non-vector graphic format (*.jpg), the tcolorbox and its shadow is not jaggy at all, since they are using vector graphics commands. I can't do anything against jaggy formats as is – Christian Hupfer Aug 6 '14 at 10:44
I think everyone understands it's a joke :) – Lembik Aug 6 '14 at 11:56
\documentclass{beamer}
\usepackage{tikz}

% #1: Optional aditional tikz options
% #2: Name of the node to "decorate"
\begin{pgfonlayer}{background}
\rotatebox{10}{%
($(#2.north west)+(.3ex,-.5ex)$)
-- ($(#2.south west)+(.5ex,-.7ex)$)
.. controls ($(#2.south)!.3!(#2.south west)$) .. (#2.south)
.. controls ($(#2.south)!.3!(#2.south east)$) .. ($(#2.south east)+(-.5ex,-.7ex)$)
-- ($(#2.north east)+(-.3ex, -.5ex)$)
-- cycle;
}
\end{pgfonlayer}
}

\begin{document}
\begin{frame}

\begin{tikzpicture}

\rotatebox{10}{%

\node[draw=black!40, fill=white, rectangle, minimum width=4.5cm, minimum height=4.5cm]
(example) {
\setlength{\fboxrule}{0.2pt}%
\setlength{\fboxsep}{0pt}%
\fbox{%
\includegraphics{example-grid-100x100bp.pdf}%
}%
};
}
\end{tikzpicture}

\end{frame}
\end{document}


-
That's a very nice shadow! – Lembik Aug 6 '14 at 11:22

Here is a flexible and customizable solution usable into a tikzpicture.

Description of keys:

• at defines the center of the picture,
• graphics options defines the options used by \includegraphics,
• rotate defines the global rotation of the polaroid,
• caption define the content of the caption,
• caption distance defines the distance between the top of caption and the bottom of the picture,
• top margin, bottom margin, left margin, right margin, vmargin, hmargin and margin are used to define the margins between the picture and the borders of the polaroid,

• caption option defines the options used by the caption node,

• frame options defines the options used by the frame node (the whole polaroid).

Each key has a default value. The optional argument of \polaroid macro is used to change these value for a particular polaroid. You may use \polaroidset to change the default values for all subsequent polaroids in the current group.

\documentclass[tikz]{standalone}%
\tikzset{
polaroid/.cd,
at/.store in=\polaroidat,
at={0,0},
graphics options/.store in=\polaroidgraphicsoptions,
graphics options=,
rotate/.store in=\polaroidrotate,
rotate=0,
caption/.store in=\polaroidcaption,
caption=,
caption distance/.store in=\polaroidcaptiondistance,
caption distance=1mm,
top margin/.store in=\polaroidtopmargin,
bottom margin/.store in=\polaroidbottommargin,
left margin/.store in=\polaroidleftmargin,
right margin/.store in=\polaroidrightmargin,
vmargin/.style={top margin=#1,bottom margin=#1},
hmargin/.style={left margin=#1,right margin=#1},
margin/.style={vmargin=#1,hmargin=#1},
margin=1cm,
caption default/.style={font=\bfseries,node distance=1mm},
caption options/.style={caption default/.append style={#1}},
frame default/.style={draw,inner sep=0},
frame options/.style={frame default/.append style={#1}},
}
\newcommand\polaroidset[1]{\tikzset{polaroid/.cd,#1}}
\newcommand\polaroid[2][]{
\bgroup
\tikzset{polaroid/.cd,#1}
\pgfmathsetmacro\polaroidrotate{\polaroidrotate}
\begin{scope}[shift={(\polaroidat)},rotate=\polaroidrotate]
\node[rotate=\polaroidrotate,inner sep=0]
(shoot) {\expandafter\includegraphics\expandafter[\polaroidgraphicsoptions]{#2}};
\path (shoot.north) ++(0,\polaroidtopmargin) coordinate (polaroid top);
\path (shoot.south) ++(0,{-1*(\polaroidbottommargin)}) coordinate (polaroid bottom);
\path (shoot.west) ++({-1*(\polaroidleftmargin)},0) coordinate (polaroid left);
\path (shoot.east) ++(\polaroidrightmargin,0) coordinate (polaroid right);
\node[rotate fit=\polaroidrotate,fit=(polaroid top)(polaroid bottom)(polaroid left)(polaroid right),polaroid/frame default]{};
\node[rotate=\polaroidrotate,inner sep=0]
(shoot) {\expandafter\includegraphics\expandafter[\polaroidgraphicsoptions]{#2}};
\coordinate (caption center) at ($(shoot.south)!-1 * \polaroidcaptiondistance!(shoot.north)$);
\node[anchor=north,rotate=\polaroidrotate,polaroid/caption default]
(caption) at (caption center) {\polaroidcaption};
\end{scope}
\egroup
}

\begin{document}%

\begin{tikzpicture}
\polaroid[rotate=-10,
graphics options={width=4cm}]
{face}
\end{tikzpicture}

\begin{tikzpicture}
\polaroidset{
rotate=20,
graphics options={width=2.5cm},
caption options={font=\footnotesize,align=center},
caption distance=.5mm,
vmargin=5mm,hmargin=5mm,
bottom margin=5mm+1em,
}
\foreach \i in {0,...,6}{
\polaroid[rotate={90-\i*30},at={{90-\i*30+90}:5cm},caption=Hello\\World]{face}
}
\end{tikzpicture}

\end{document}

-
That is really great. Thank you. I notice that you (and others) have really made an attractive picture frame not a polaroid. The dimensions in a polaroid are different as are the margins. That is narrow margins at the top and side and the overall frame is not square. Of course with your lovely flexible solution this is easy to fix. – Lembik Aug 7 '14 at 14:33