epstopdf
takes the bounding box of SmatExample.eps
:
%%BoundingBox: 14 14 723 1147
to create the PDF file. The image is moved to (0,0),
and a new media size is calculated:
/MediaBox [0 0 709 1133]
The coordinates of gv
/gsview
/... are based on the EPS version. For the PDF version and viewport
, the coordinates needs to be corrected by subtracting the old origin values of the bounding box. Actually the following example subtracts 13 in both cases:
\documentclass[compress,red,notes]{beamer}
\begin{document}
\frame{\frametitle{}
\begin{columns}
\begin{column}{0.5\textwidth}
\includegraphics[width=\textwidth, viewport=0 717 658 1133, clip]{SmatExample}
\\
\includegraphics[width=\textwidth, viewport=0 426 709 709, clip]{SmatExample}
\end{column}
\begin{column}{0.5\textwidth}
\includegraphics[width=\textwidth, viewport=0 0 709 422, clip]{SmatExample}
\end{column}
\end{columns}
}
\end{document}
\fbox
is helpful for a visual control of the viewports:
\documentclass[compress,red,notes]{beamer}
\begin{document}
\setlength{\fboxsep}{0pt}
\setlength{\fboxrule}{.1pt}
\frame{\frametitle{}
\begin{columns}
\begin{column}{0.5\textwidth}
\fbox{\includegraphics[width=\textwidth, viewport=0 717 658 1133, clip]{SmatExa
\\
\fbox{\includegraphics[width=\textwidth, viewport=0 426 709 709, clip]{SmatExam
\end{column}
\begin{column}{0.5\textwidth}
\fbox{\includegraphics[width=\textwidth, viewport=0 0 709 422, clip]{SmatExampl
\end{column}
\end{columns}
}
\end{document}
Best Answer
I don't know of a way to clip an image without using additional packages (apart from
graphicx
, I assume). There is a way of doing it with TikZ, which is probably better than no solution.This is based on the answers to the question Drawing on an image with TikZ. I've written a macro that takes an image name with the accompanying
\includegraphics
options and a TikZ path as arguments to either display the image overlaid with a grid and the path, or to use the path to clip the image. The behaviour is toggled using\tikzset{develop clipping path=true}
to switch on the grid and the path display, and\tikzset{develop clipping path=false}
to perform the actual clipping once the path has been developed.