插入圖形 - 鋸齒狀邊緣表明它只是整體的一部分

插入圖形 - 鋸齒狀邊緣表明它只是整體的一部分

我想明確指出,插入的圖形只是整體的一部分。由於直切看起來就像插入的假,我想知道是否有任何技巧可以顯示修剪邊的鋸齒。例如這樣的事情:

鋸齒狀頁面

答案1

您可以decorations在 TikZ 中使用 來變形路徑random steps。當然,您可以自訂這些隨機步驟。

我使用了\clip硬編碼座標,從圖像的左上角開始,然後右上角,向下到大約 2/3,然後在關閉路徑之前再次向左。如果變更width包含圖形的 ,請確保相應地變更剪切座標。

儘管這可以使用變數輕鬆解決。

輸出

在此輸入影像描述

程式碼

\documentclass[margin=15pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{calc, decorations.pathmorphing}

\newcommand\myimgwidth{\linewidth} % one measure to rule them all

\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro\myheight{(\myimgwidth/4)*2}
\clip[preaction={draw, line width=.8pt}] (0,0) -- (\myimgwidth,0) -- (\myimgwidth,-\myheight pt) decorate[decoration={random steps,segment length=2mm,amplitude=.1cm}] {(\myimgwidth,-\myheight pt) -- (0,-\myheight pt)} -- (0,0);

\node[inner sep=0pt, outer sep=0pt, anchor=north west] at (0,0) {\includegraphics[width=\myimgwidth,keepaspectratio]{example-image-a}};

\end{tikzpicture}
\end{document}

相關內容