6

I would like to zoom in on one of the 12 images that I have organized in 3 columns. There are 4 images per column, all the same height and width.

There is one image that I would like to zoom in on and highlight in a circle in the center of the slide.

I have been trying to accomplish this using tikzpicture but, as you will be able to see in my MWE, the zoom is not being "superimposed" on the slide, but rather interfering with the organization of the other images. Besides that, I am not zooming in on the entire image, but rather on a part of it.

How can I fix my code to arrive at my desired final result?

\documentclass[10pt, compress]{beamer}
\usepackage{tikz}
\usetikzlibrary{spy}


\begin{frame}

\begin{columns}[t]
\column{.3\textwidth}
\centering
\includegraphics[width=3cm,height=1.75cm]{img1}\\
\includegraphics[width=3cm,height=1.75cm]{img2}\\
\includegraphics[width=3cm,height=1.75cm]{img3}\\
\includegraphics[width=3cm,height=1.75cm]{img4}
\column{.3\textwidth}
\centering
\includegraphics[width=3cm,height=1.75cm]{img5}\\
\includegraphics[width=3cm,height=1.75cm]{img6}\\
\includegraphics[width=3cm,height=1.75cm]{img7}\\
\includegraphics[width=3cm,height=1.75cm]{img8}\\
\column{.3\textwidth}
\centering
\includegraphics[width=3cm,height=1.75cm]{img9}\\
%%% this is the image that I want to zoom in on
\begin{tikzpicture}[
spy using outlines={
  circle,
  magnification=10,
  size=5cm,
  connect spies}]
\node[inner sep=0pt] {\pgfimage[width=3cm,height=1.75cm]{img10}};
\only<2>{\spy[red!70!black] on (0.88,0.15) in node at (.5\textwidth,0);}
\end{tikzpicture}
\includegraphics[width=3cm,height=1.75cm]{img11}\\
\includegraphics[width=3cm,height=1.75cm]{img12}\\

\end{columns}
\end{frame}
\end{document}

Basically, my main question is how can I zoom in on ONE entire image of the 12 above?

Here is what is happening, so far: Error that the code is making

  • 2
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Henri Menke Feb 26 '15 at 17:17
  • 1
    Thank you for the tip @HenriMenke I already updated the code in the example. – owwoow14 Feb 26 '15 at 17:23
  • 1
7

Use the overlay option to your tikzpicture; if additionally you use remember picture, now you have access to the current page nodes and you can place the spying glass on current page.center, for example (this last part is, of course, optional; you can place the magnifying glass anywhere you want on the frame using absolute coordinates too); the important thing is to place the glass in a space that won't be occupied for object added after the glass (otherwise, those objects would overlap the glass).

Here's a little example:

\documentclass[10pt, compress]{beamer}
\usepackage{tikz}
\usetikzlibrary{spy}

\begin{document}

\begin{frame}

\begin{columns}[t]
\column{.3\textwidth}
  \centering
  \includegraphics[width=3cm,height=1.75cm]{example-image-a}\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-a}\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-a}\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-a}
\column{.3\textwidth}
  \centering
  \includegraphics[width=3cm,height=1.75cm]{example-image-b}\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-b}\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-b}\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-b}\\
\column{.3\textwidth}
  \centering
  \includegraphics[width=3cm,height=1.75cm]{example-image-c}\\
  \parbox[c][1.75cm][c]{3cm}{%
    \begin{tikzpicture}[
      overlay,
      remember picture,
      spy using outlines={%
        circle,
        magnification=10,
        size=5cm,
        connect spies
        }
    ]
    \node[
      inner sep=0pt,
      anchor=west,
      outer sep=0pt
    ] 
    {\pgfimage[width=3cm,height=1.75cm]{example-image-c}};
    \only<2>{%
      \spy[red!70!black] on (1.4,0.15) in node at (current page.center);
    }
    \end{tikzpicture}%
  }\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-c}\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-c}
\end{columns}

\end{frame}

\end{document}

An animation of the output:

enter image description here

If you want to zoom on the whole image, you can adjust the magnification, width and height keys (width=magnificationximage width, height=magnificationximage height):

\documentclass[10pt, compress]{beamer}
\usepackage{tikz}
\usetikzlibrary{spy}

\begin{document}

\begin{frame}

\begin{columns}[t]
\column{.3\textwidth}
  \centering
  \includegraphics[width=3cm,height=1.75cm]{example-image-a}\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-a}\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-a}\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-a}
\column{.3\textwidth}
  \centering
  \includegraphics[width=3cm,height=1.75cm]{example-image-b}\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-b}\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-b}\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-b}\\
\column{.3\textwidth}
  \centering
  \includegraphics[width=3cm,height=1.75cm]{example-image-c}\\
  \parbox[c][1.75cm][c]{3cm}{%
    \begin{tikzpicture}[
      overlay,
      remember picture,
      spy using outlines={%
        magnification=2.5,
        width=7.5cm,
        height=4.375cm,
        connect spies
        }
    ]
    \node[
      inner sep=0pt,
      anchor=west,
      outer sep=0pt
    ] (a)
    {\pgfimage[width=3cm,height=1.75cm]{example-image-c}};
    \only<2>{%
      \spy[red!70!black] on (1.5,0) in node at ([xshift=-2cm]current page.center);
    }
    \end{tikzpicture}%
  }\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-c}\\
  \includegraphics[width=3cm,height=1.75cm]{example-image-c}
\end{columns}

\end{frame}

\end{document}

enter image description here

  • Thanks @GonzaloMedina this is a great solution, however, it still does not address the issue of magnifying the entire image. As in your video example, the magnifying class is magnifying a small portion of the image, I would like to magnify the entire image. Is there a way to tweak the coordinates in the code in order to do that? – owwoow14 Feb 26 '15 at 21:32
  • 1
    @owwoow14 Please see my updated answer. Is it something like that what you had in mind? – Gonzalo Medina Feb 26 '15 at 22:19
  • Your updated answer is exactly what I had in mind. Works perfectly, thanks. – owwoow14 Feb 27 '15 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.