# Crop image to path created in TikZ?

Is it possible to use a curved path created in TikZ within a LaTeX document to crop an image to fit it, or should I do this in (eg) GIMP outside the document and just insert the image?

I have the (very lo-res) template below which I need to populate with a fragment of a large hi-res image for a poster, and have a better smooth curved edge than the one which would result from just re-using the template in GIMP.

I know the locations of the points of inflection in terms of percent of image width and height, but I lack the syntax and vocabulary to express this in TikZ and then place the \includeimage[]{} so that only the portion bounded by the template is visible.

Yes, it is.

\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\clip (0,0) to[out=0,in=180] ++ (6,1) -- ++ (0,1)
to[out=180,in=0] ++ (-6,-1) -- cycle;
\node at (3,1)  {\includegraphics{example-image-duck}};
\end{tikzpicture}
\end{document}


• In terms of disk space, it is not clear whether the invisible portion of the cropped image is still embedded in the final file, .pdf probably. That would be nice to get rid of it in some way. – pluton Apr 8 '19 at 18:07
• @pluton I cannot answer your question and even do not know if that is a real LaTeX question. I believe that there are tools out there that do what you are suggesting, but I never worked with them, let alone tried to involve them in the LaTeX workflow. – user121799 Apr 8 '19 at 18:15
• That is outstanding, thank you so much. I have learned a lot from that. – Peter Flynn Apr 8 '19 at 18:50
• And @pluton alas yes, the whole rectangle of the original image is still stored in the PDF document. You could save a little space by editing it to blank out the invisible portion (plus a margin) by setting it to a plain colour or to transparent, I guess. – Peter Flynn Apr 8 '19 at 18:52