![插入圖形 - 鋸齒狀邊緣表明它只是整體的一部分](https://rvso.com/image/330744/%E6%8F%92%E5%85%A5%E5%9C%96%E5%BD%A2%20-%20%E9%8B%B8%E9%BD%92%E7%8B%80%E9%82%8A%E7%B7%A3%E8%A1%A8%E6%98%8E%E5%AE%83%E5%8F%AA%E6%98%AF%E6%95%B4%E9%AB%94%E7%9A%84%E4%B8%80%E9%83%A8%E5%88%86.png)
答案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}