3

I want to slice an image into 8 parts, i.e., 2 rows by 4 columns. Each part is on a single page as follows. The gray frame is the Acrobat Reader background, so don't think it is a part of the output I want to have.

enter image description here

\documentclass{minimal}
\usepackage[margin=2cm,a6paper]{geometry}
\usepackage{graphicx}
\newsavebox\IBox
\savebox\IBox{\includegraphics{bald}}
\newdimen\width
\newdimen\height
\width=\wd\IBox
\height=\ht\IBox
\parindent=0bp
\usepackage{multido}
\begin{document}
\centering%
%first row
\fbox{\includegraphics[height=\textheight,viewport={0\width} {0.5\height} {0.25\width} {\height},clip]{bald}}
\fbox{\includegraphics[height=\textheight,viewport={0.25\width} {0.5\height} {0.5\width} {\height},clip]{bald}}
\fbox{\includegraphics[height=\textheight,viewport={0.5\width} {0.5\height} {0.75\width} {\height},clip]{bald}}
\fbox{\includegraphics[height=\textheight,viewport={0.75\width} {0.5\height} {\width} {\height},clip]{bald}}
%second row
\fbox{\includegraphics[height=\textheight,viewport={0\width} {0\height} {0.25\width} {0.5\height},clip]{bald}}
\fbox{\includegraphics[height=\textheight,viewport={0.25\width} {0\height} {0.5\width} {0.5\height},clip]{bald}}
\fbox{\includegraphics[height=\textheight,viewport={0.5\width} {0\height} {0.75\width} {0.5\height},clip]{bald}}
\fbox{\includegraphics[height=\textheight,viewport={0.75\width} {0\height} {\width} {0.5\height},clip]{bald}}
\end{document}

If you need the image to be sliced, here it is.

enter image description here

I have attempted to translate it using nested \multido macros as follows but it did work. I think it is because I have no enough knowledge in doing length manipulation in (La)TeX.

\documentclass{minimal}
\usepackage[margin=2cm,a6paper]{geometry}
\usepackage{graphicx}
\newsavebox\IBox
\savebox\IBox{\includegraphics{bald}}
\newdimen\width
\newdimen\height
\width=\wd\IBox
\height=\ht\IBox
\parindent=0bp
\usepackage{multido}
\begin{document}
\centering
\multido{\nx=0+0.25}{4}
{%
    \multido{\ny=1+-0.5}{2}
    {%
        \fbox{\includegraphics[height=\textheight,viewport={\nx\width} {\ny\height-0.5\height} {\nx\width+0.25\width} {\ny\height},clip]{bald}}%
    }%
}
\end{document}
Display Name
  • 46,933

1 Answers1

3
\documentclass{minimal}
\usepackage[margin=2cm,a6paper]{geometry}
\usepackage{graphicx}
\newsavebox\IBox
\savebox\IBox{\includegraphics{bald}}
\newdimen\width
\newdimen\height
\width=\wd\IBox
\height=\ht\IBox
\parindent=0bp
\usepackage{multido}
\begin{document}
\centering
\multido{\ry=0.5+-0.5, \rY=1.0+-0.5}{2}{%
  \multido{\rx=0.00+0.25, \rX=0.25+0.25}{4}{%
    \fbox{\includegraphics[%height=\textheight, makes no sense without width=...
       viewport={\rx\width} {\ry\height} {\rX\width} {\rY\height},clip]{bald}}%
    }\\%
}
\end{document}

enter image description here