如何给不同的图像添加缩放框效果?

如何给不同的图像添加缩放框效果?

根据关联可以为大图像的某些部分创建放大的子图和相应的框,如下所示:

在此处输入图片描述

我想获得相同的效果,但使用不同的子图,即未从图 a 放大。有可能吗?如何实现?

先感谢您!

答案1

以下是使用评论中链接的 Caramdir 解决方案作为与软件包结合的起点的一种可能方法subcaption

\documentclass{article}
\usepackage{mwe,subcaption,tikz}
\tikzset{boximg/.style={remember picture,red,thick,draw,inner sep=0pt,outer sep=0pt}}

\begin{document}
\begin{figure}
  \centering
  \begin{subfigure}{.45\linewidth}
    \begin{tikzpicture}[boximg]
      \node[anchor=south west] (img) {\includegraphics[width=\linewidth]{example-image-a}};
      \begin{scope}[x=(img.south east),y=(img.north west)]
        \node[draw,minimum height=1.6cm,minimum width=1.00cm] (B1) at (0.2,0.60) {};
        \node[draw,minimum height=0.8cm,minimum width=0.50cm] (B2) at (0.7,0.25) {};
        \node[draw,minimum height=0.4cm,minimum width=0.25cm] (B3) at (0.9,0.10) {};
      \end{scope}
    \end{tikzpicture}
    \caption{}
  \end{subfigure}\\[0.5\baselineskip]
  \begin{subfigure}{.45\linewidth}
    \begin{tikzpicture}[boximg]
      \node (img1) {\includegraphics[width=0.3\linewidth]{example-image-10x16}};
      \draw (img1.south west) rectangle (img1.north east);
    \end{tikzpicture}\hfill%
    \begin{tikzpicture}[boximg]
      \node (img2) {\includegraphics[width=0.3\linewidth]{example-image-10x16}};
      \draw (img2.south west) rectangle (img2.north east);
    \end{tikzpicture}\hfill%
    \begin{tikzpicture}[boximg]
      \node (img3) {\includegraphics[width=0.3\linewidth]{example-image-10x16}};
      \draw (img3.south west) rectangle (img3.north east);
    \end{tikzpicture}
    \caption{}
  \end{subfigure}
  \begin{tikzpicture}[overlay,boximg]
    \draw (B1) -- (img1);
    \draw (B2) -- (img2);
    \draw (B3) -- (img3);
  \end{tikzpicture}
  \caption{The National Gallery of Canada}
\end{figure}
\end{document}

在此处输入图片描述

相关内容