
답변1
TikZ에서 를 사용하여 decorations
경로를 모핑 할 수 있습니다 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}