1

I want to crop an image on a complex shape. The shape will be applied to different images and used in a {beamer} presentation.

I took a example picture from here and clipped it by hand so that is looks like this:

enter image description here

The crop lines need to be adjusted to 90°/ 45° angles and corner points need to be calculated using fractions of \paperwidth and \paperheight.

I've seen this question that shows how to crop an image in general, but there the image is cropped using regular build-in shapes. So my question here is:

Based on the solution of the other question: How do I create an irregular custom shape, that I can use to crop an image?

3
  • What will appear outside the cropped area? For example, within the "whitespace" at the top right? You could consider this to be a rectangular image with a white irregular shape overlaid on the image - easily doable with Tikz... unless you want the background of the beamer theme to show through.
    – Werner
    Jun 15 at 19:30
  • 1
    This might be useful: How can I invert a 'clip' selection within TikZ?
    – Werner
    Jun 15 at 19:33
  • @Werner At least it shows how to create the custom shape. Unfortunately I have no clue how to replace the circle part in the clipping example I found first... Jun 15 at 20:22
4

Is that what you want? In fact, by adding an image through TikZ's node, name it, say (A), scale it if needed, then on that image, from anchors (like (A.120), (A.north east), etc) you can draw, fill, clip, or put some pic with any shape you design.

enter image description here

\documentclass[aspectratio=169]{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}{Drawing on an image}
\begin{center}
\begin{tikzpicture}
%https://de.wikipedia.org/wiki/Datei:L%27automne_au_Qu%C3%A9bec_(8072544123).jpg
\node[scale=1.2,inner sep=0] (A) {\includegraphics{autumn}};
\draw[white,fill=white] (A.110)
--++(-90:1)--++(-45:2)--++(0:2)--++(-45:1.5)
--++(-90:1.5)-|(A.north east)--cycle;
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}

Here is a clipping using pic.

enter image description here

\documentclass[aspectratio=169]{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}{Clipping on an image}
\begin{center}
\begin{tikzpicture}[house/.pic={
\fill[white] (-1,0)--(1,0)--(1,1.5)--(0,2)--(-1,1.5)--cycle;    
}]
%https://de.wikipedia.org/wiki/Datei:L%27automne_au_Qu%C3%A9bec_(8072544123).jpg
\node[scale=1.2,inner sep=0] (A) {\includegraphics{autumn}};
\path ([shift={(-3,.5)}]A.center) pic[scale=.8]{house};
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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