Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

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{adjustbox}
\usepackage[utf8]{inputenc}
\usepackage{default}
\usepackage[font=small,skip=0pt]{caption}
\usepackage{lmodern}

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

This gives

enter image description here

share|improve this question
1  
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 at 9:43
2  
Oh! Aishwarya Rai in TeX.SX. :-) –  Harish Kumar Aug 6 at 9:50
2  
@ChristianHupfer Thanks. You are right. I have never used TikZ except by copy and pasting to be honest but I will do my best. –  eleanora Aug 6 at 9:57

3 Answers 3

up vote 16 down vote accepted

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}%

\newcommand{\polaroid}[5][top=1cm,left=1cm,right=1cm,bottom=1cm,boxsep=0pt,colback=white,width=8cm,arc=0pt,auto outer arc,fuzzy shadow={2mm}{-2mm}{1mm}{0.3mm}{black}]{%
\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}

enter image description here

Old version

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

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

\begin{document}%

\rotatebox{10}{\begin{tcolorbox}[width=8cm]%[shadow={2mm}{-1mm}{0mm}{black!50!white}]
\begin{center}
\includegraphics[scale=0.5]{bild_erwin_schroedinger}

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


\end{document}

enter image description here

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

enter image description here

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

share|improve this answer
11  
You made a mistake. There are not enough stars to spell brainy. –  eleanora Aug 6 at 10:13
3  
Erwin is very aishwary in that foto though –  percusse Aug 6 at 10:37
    
@eleanora: I meant sexy, not brainy :D :D –  Christian Hupfer Aug 6 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 at 10:44
1  
I think everyone understands it's a joke :) –  eleanora Aug 6 at 11:56

Based on http://tex.stackexchange.com/a/180442/36296

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{backgrounds, calc, shadows, shadows.blur}

\newcommand\addcurlyshadow[2][]{
    % #1: Optional aditional tikz options
    % #2: Name of the node to "decorate"
    \begin{pgfonlayer}{background}
        \rotatebox{10}{%
            \path[blur shadow={shadow xshift=0pt, shadow yshift=0pt, shadow blur steps=6}, #1]
            ($(#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}%
                }%
            };
            \addcurlyshadow{example}
        }
        \end{tikzpicture}

    \end{frame}
\end{document}

enter image description here

share|improve this answer
2  
That's a very nice shadow! –  eleanora Aug 6 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.

enter image description here

enter image description here

\documentclass[tikz]{standalone}%
\usetikzlibrary{fit,calc,shadows,backgrounds,positioning}
\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,
  frame options={line width=1pt,draw,rounded corners=.5mm,fill=white,drop shadow},
  graphics options={width=4cm}]
  {face}
\end{tikzpicture}

\begin{tikzpicture}
  \polaroidset{
    rotate=20,
    frame options={line width=1pt,draw=cyan,rounded corners=.5mm,fill=cyan!10,drop shadow},
    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}
share|improve this answer
    
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. –  eleanora Aug 7 at 14:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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