
答案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}