4

I would like to have an arbitrary polygon filled with an image (jpg, png, pdf, ...) for it to be included in a beamer frame.

I was thinking this may be possible using tikz, but I couldn't figure it out.

Thanks in advance!

percusse
  • 157,807
Bastian
  • 637

1 Answers1

8

Crop jpeg into circular tikz node is valid for any kind of node (rectangle, circle or any already defined shape), but you can also define irregular polygons with a clip path:

\documentclass{beamer}
\usepackage{tikz}

\begin{document}

\begin{frame}{I'm watching you!}
\centering
\begin{tikzpicture}
\clip (-1,1)--++(-20:5cm)--++(75:4.5)--++(150:2cm)--++(200:3.5)--cycle; 
\node at (2,2) {\includegraphics[width=6cm]{frog}};
\end{tikzpicture}
\end{frame}

\end{document}

enter image description here

Ignasi
  • 136,588
  • great! this is what I was looking for. Could you help me with the specification of the polygon nodes? Let's say I want a polygon with the corner coordinates (x,y) = (0cm,0cm) (1cm,0cm) (2cm,1cm) (0cm,1cm), what is the \clip line going to look like? Thanks – Bastian Jun 02 '16 at 12:15
  • @Bastian \clip (0,0) --(1,0)-- (2,1)--(0,1)--cycle; – Ignasi Jun 02 '16 at 13:26