# A movie film strip of images

Is it possible to make a movie film strip of embedded PDF images?

• I' m not sure what you mean. Do you mean to say that you want to place pdf images, all taken from one pdf (or maybe multiple pdfs, maybe one per pdf), into a new pdf, such that all the images are in a line with a filmstrip boundary, such as the one you have shown? – Jānis Lazovskis Mar 27 '14 at 4:02
• One image per PDF file. Is it possible to frame them so that they could seem to be part of a movie film strip ? – SDrolet Mar 27 '14 at 17:27
• One image per PDF file. Multiple images. The goal is to frame them so that they could seem to be part of a movie film strip, therefore to put all the images in line with a filmstrip boundary. – SDrolet Mar 27 '14 at 17:34

\documentclass{article}

\usepackage{color,graphicx}

\newcommand{\whitebox}{\hfill\textcolor{white}{\rule[1mm]{1.8mm}{2.8mm}}\hfill}
\newcommand{\filmbox}[1]{%
\setlength{\fboxsep}{0pt}%
\colorbox{black}{%
\begin{minipage}{3.2cm}
\rule{0mm}{4.8mm}\whitebox\whitebox\whitebox\whitebox\whitebox%
\whitebox\whitebox\whitebox\whitebox\null\\%
\null\hfill\includegraphics[width=3cm]{#1}\hfill\null\\[1mm]%
\null\whitebox\whitebox\whitebox\whitebox\whitebox%
\whitebox\whitebox\whitebox\whitebox\null
\end{minipage}}}

\begin{document}

\noindent
\filmbox{1}\filmbox{2}\filmbox{3}\\
\filmbox{4}\filmbox{5}\filmbox{6}

\end{document}


As SDrolet pointed out, the frames will be uneven if the included pictures have different aspect ratios. This can be solved in two ways:

• Trimming to a specific size, using SDrolet's solution. This means losing part of the picture.
• Scaling to a specific size, by adding the height option of \importgraphics in the definition of \filmbox. This means distorting the picture.

Jonas Granholm provided a clever solution. However, if the images are not of the same dimensions, the movie strip will be uneven (e.g.: first movie film strip, below). The "adjustbox" package (Martin Sharrer) and the code provided by Amaru / Paul Gaborit help to fix that problem (e.g.: second movie film strip below). Here is the final code:

\documentclass{book}

\usepackage{color}
\usepackage{graphicx}
\usepackage{calc}
\usepackage{ifthen}

% % % Method to adjust images to the same dimensions
% % % By Amaru / Paul Gaborit / based on Martin Sharrer package "adjustbox" http://tex.stackexchange.com/questions/60918/how-to-scale-and-then-trim-an-image/61073#61073

\newlength{\oH}
\newlength{\oW}
\newlength{\rH}
\newlength{\rW}
\newlength{\cH}
\newlength{\cW}

\newcommand\ClipImage[3]{% width, height, image
\settototalheight{\oH}{\includegraphics{#3}}%
\settowidth{\oW}{\includegraphics{#3}}%
\setlength{\rH}{\oH * \ratio{#1}{\oW}}%
\setlength{\rW}{\oW * \ratio{#2}{\oH}}%
\ifthenelse{\lengthtest{\rH < #2}}{%
\setlength{\cW}{(\rW-#1)*\ratio{\oH}{#2}}%
}{%
\setlength{\cH}{(\rH-#2)*\ratio{\oW}{#1}}%
}%
}

% %
% % Explanation for movie film strip cells:
% %
% %  The basic cell is made of a black colorbox (colorbox).
% %              \colorbox{color}{text} : same color as \textcolor{color}{text}
% %  Multiple lines of text can be placed inside a colorbox providing that they are included in a minipage of a specified width.
% %              \begin{minipage}{width} text \end{minipage}
% %  The first and last lines of text are composed of nine small colored (white) rules (boxes) equally spaced with \hfill. The color of each rule is the same as the textcolor.
% %              \textcolor{color}{text}
% %              \rule[depth]{width}{height}
% %              \null is the same as \hbox{} and it can be used for a material which reserves no space but shows TeX that there is a box which is taken into account for typesetting (Herbert: http://tex.stackexchange.com/questions/24919/what-is-null-and-when-do-we-need-to-use-it)
% %
% %
% %

\newcommand{\whitebox}{\hfill\textcolor{white}{\rule[1mm]{1.8mm}{2.8mm}}\hfill}

\newcommand{\SetColorForColoredSmallBoxes}[1]{ %
\def\ColoredSmallBox{\hfill\textcolor{#1}{\rule[1mm]{1.8mm}{2.8mm}}\hfill}}

\SetColorForColoredSmallBoxes{red}

\newcommand{\filmbox}[1]{%  ( Jonas Granholm )
\setlength{\fboxsep}{0pt}%
\colorbox{black}{%
\begin{minipage}{3.2cm}
\rule{0mm}{4.8mm}\whitebox\whitebox\whitebox\whitebox\whitebox%
\whitebox\whitebox\whitebox\whitebox\null\\%
\null\hfill\includegraphics[width=3cm]{#1}\hfill\null\\[1mm]%
\null\whitebox\whitebox\whitebox\whitebox\whitebox%
\whitebox\whitebox\whitebox\whitebox\null
\end{minipage}}}

\newcommand{\filmboxClipImage}[1]{%
\setlength{\fboxsep}{0pt}%
\colorbox{black}{%
\begin{minipage}{3.2cm}
\rule{0mm}{4.8mm}
\ColoredSmallBox\whitebox\ColoredSmallBox\whitebox\ColoredSmallBox
\whitebox\ColoredSmallBox\whitebox\ColoredSmallBox\null\\%
\null\hfill\ClipImage{3cm}{3cm}{#1}\hfill\null\\[1mm]%
\null\whitebox\whitebox\whitebox\whitebox\whitebox%
\whitebox\whitebox\whitebox\whitebox\null
\end{minipage}}}

\begin{document}

\noindent
\filmbox{First-rectangle}\filmbox{Second-rectangle}\filmbox{Third-rectangle}\\

\noindent
\filmboxClipImage{First-rectangle}\filmboxClipImage{Second-rectangle}\filmboxClipImage{Third-rectangle}\\

\end{document}


• Nice addition :) There has snuck in a bit of uneven spacing in the top row of \filmboxClipImage, that should be removed by adding a % immediately after \rule{0mm}{4.8mm} in the definition. – Jonas Granholm Mar 29 '14 at 14:27
• Wow ! Corrected code below. – SDrolet Mar 29 '14 at 22:02

Here is the final code, including the correction suggested by Jonas Granholm.

\documentclass{book}

\usepackage{color}
\usepackage{graphicx}
\usepackage{calc}
\usepackage{ifthen}

% % % Method to adjust images to the same dimensions
% % % By Amaru / Paul Gaborit / based on Martin Sharrer package "adjustbox" http://tex.stackexchange.com/questions/60918/how-to-scale-and-then-trim-an-image/61073#61073

\newlength{\oH}
\newlength{\oW}
\newlength{\rH}
\newlength{\rW}
\newlength{\cH}
\newlength{\cW}

\newcommand\ClipImage[3]{% width, height, image
\settototalheight{\oH}{\includegraphics{#3}}%
\settowidth{\oW}{\includegraphics{#3}}%
\setlength{\rH}{\oH * \ratio{#1}{\oW}}%
\setlength{\rW}{\oW * \ratio{#2}{\oH}}%
\ifthenelse{\lengthtest{\rH < #2}}{%
\setlength{\cW}{(\rW-#1)*\ratio{\oH}{#2}}%
}{%
\setlength{\cH}{(\rH-#2)*\ratio{\oW}{#1}}%
}%
}

% %
% % Explanation for movie film strip cells:
% %
% %  The basic cell is made of a black colorbox (colorbox).
% %              \colorbox{color}{text} : same color as \textcolor{color}{text}
% %  Multiple lines of text can be placed inside a colorbox providing that they are included in a minipage of a specified width.
% %              \begin{minipage}{width} text \end{minipage}
% %  The first and last lines of text are composed of nine small colored (white) rules (boxes) equally spaced with \hfill. The color of each rule is the same as the textcolor.
% %              \textcolor{color}{text}
% %              \rule[depth]{width}{height}
% %              \null is the same as \hbox{} and it can be used for a material which reserves no space but shows TeX that there is a box which is taken into account for typesetting (Herbert: http://tex.stackexchange.com/questions/24919/what-is-null-and-when-do-we-need-to-use-it)
% %
% %
% %

\newcommand{\whitebox}{\hfill\textcolor{white}{\rule[1mm]{1.8mm}{2.8mm}}\hfill}

\newcommand{\SetColorForColoredSmallBoxes}[1]{%
\def\ColoredSmallBox{\hfill\textcolor{#1}{\rule[1mm]{1.8mm}{2.8mm}}\hfill}}

\SetColorForColoredSmallBoxes{red}

\newcommand{\filmbox}[1]{%  ( Jonas Granholm )
\setlength{\fboxsep}{0pt}%
\colorbox{black}{%
\begin{minipage}{3.2cm}
\rule{0mm}{4.8mm}\whitebox\whitebox\whitebox\whitebox\whitebox%
\whitebox\whitebox\whitebox\whitebox\null\\%
\null\hfill\includegraphics[width=3cm]{#1}\hfill\null\\[1mm]%
\null\whitebox\whitebox\whitebox\whitebox\whitebox%
\whitebox\whitebox\whitebox\whitebox\null
\end{minipage}}}

\newcommand{\filmboxClipImage}[1]{%
\setlength{\fboxsep}{0pt}%
\colorbox{black}{%
\begin{minipage}{3.2cm}
\rule{0mm}{4.8mm}%
\ColoredSmallBox\whitebox\ColoredSmallBox\whitebox\ColoredSmallBox
\whitebox\ColoredSmallBox\whitebox\ColoredSmallBox\null\\%
\null\hfill\ClipImage{3cm}{3cm}{#1}\hfill\null\\[1mm]%
\null\whitebox\whitebox\whitebox\whitebox\whitebox%
\whitebox\whitebox\whitebox\whitebox\null
\end{minipage}}}

\begin{document}

\noindent
\filmbox{First-rectangle}\filmbox{Second-rectangle}\filmbox{Third-rectangle}\\

\noindent
\filmboxClipImage{First-rectangle}\filmboxClipImage{Second-rectangle}\filmboxClipImage{Third-rectangle}\\

\end{document}