\documentclass[utf8,12pt]{book}

\usepackage[T1]{fontenc}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage{graphicx}
\usepackage{color}
\usepackage{lscape}
\usepackage{ifthen}
% Pixelspeed, quadratisch, 128 Seiten:
% Inhalt: 202x202 mm, plus oben/unten/aussen 3mm Beschnittzugabe
% Umschlag: je Seite 202x202 mm plus ueberall 3 mm Beschnittzugabe, plus Ruecken 14 mm, plus Beschnittzugabe 9 mm ueberall => 208x208 * 2 + 14 + Beschnitt = (2*208+14+18)x(208+18) = 448x226mm

% ePubli, quadratisch:
% siehe http://www.epubli.de/projects/anleitung/formatrules?wordprocessor=word2007
% Inhalt: 205x205mm, plus ueberall 3mm Beschnittzugabe => 211x211 mm
% Umschlag: 205x205 mm, plus 6 mm Einschlagrand aussen, plus 9 mm Gelenk innen => 220x217 mm
% Formatierung Umschlag: Inhalt auf Nettogroesse zentrieren, Abstand halten zu Raendern, Bilder auf Einschlagrand und evtl. Gelenk fortsetzen

%\usepackage[paperwidth=205mm, paperheight=208mm, top=1mm, bottom=1mm, inner=0mm, outer=1mm]{geometry}
%\usepackage[paperwidth=211mm, paperheight=211mm, top=1mm, bottom=1mm, inner=1mm, outer=1mm]{geometry}
\usepackage[paperwidth=211mm, paperheight=211mm, top=1.5mm, bottom=1.5mm, inner=1.5mm, outer=1.5mm]{geometry}	% ePubli
\usepackage[none]{hyphenat}	% disable hyphenation
\usepackage[pdfstartview=Fit]{hyperref}

\pagestyle{empty}
\pagecolor{black}
\color{white}
	
\newcommand{\landscapephoto}[2]{%
\vspace*{\fill}%
\includegraphics[width=\textwidth]{#1}\\[\commentspace]\ifthenelse{\isodd{\thepage}}{#2\hspace*{\lrdiffspace}}{\hspace*{\lrdiffspace}#2}%
\vspace*{\fill}%
\newpage
}

\newcommand{\portraitphoto}[2]{%
\ifthenelse{\isodd{\thepage}}{\hspace*{-\lrdiffspace}\includegraphics[height=\textheight]{#1}}{}%	include the image and add some space => image is shifted by 0.5\cropspace to the left
	\begin{picture}(0,0)%
		\put(0,0.5){%
			\ifthenelse{\isodd{\thepage}}{%
				\makebox(0,0)[l]{%	right page
					\hspace*{\commentspace}%
					\begin{minipage}{\commentwidth}\raggedright #2\end{minipage}%
				}%
			}{%
				\makebox(0,0)[r]{%	left page
					\begin{minipage}{\commentwidth}\raggedleft #2\end{minipage}%
					\hspace*{\commentspaceeven}%
				}%
			}%
		}%
	\end{picture}%
%
	\ifthenelse{\isodd{\thepage}}{}{\hspace*{\lrdiffspace}\includegraphics[height=\textheight]{#1}}%	include the image and add some space => image is shifted by 0.5\cropspace to the right
	\newpage
}

\begin{document}
	\setlength{\unitlength}{\textheight}

	\newlength{\commentspace}
	\setlength{\commentspace}{1ex}	% the whitespace between the image and the comment

	\newlength{\cropspace}
	%\setlength{\cropspace}{2mm}		% the difference between the given page margins and the true margins, i.e. the amount that is cropped additionally to the margin
	\setlength{\cropspace}{1.5mm}		% the difference between the given page margins and the true margins, i.e. the amount that is cropped additionally to the margin

	\newlength{\lrdiffspace}
	%\setlength{\lrdiffspace}{\cropspace}		% the difference between the inner and outer page margins; if \cropspace is only on the right, set this to \cropspace, otherwise to 0
	\setlength{\lrdiffspace}{0mm}		% the difference between the inner and outer page margins; if \cropspace is only on the right, set this to \cropspace, otherwise to 0

	\newlength{\commentwidth}			% for portrait images
	\setlength{\commentwidth}{0.125\textwidth}	% for 4:3 images, 1/4 of the page width is left over, i.e. 1/8 of \textwidth for the comment
	\addtolength{\commentwidth}{-\commentspace}	% subtract the space between image and text
	\addtolength{\commentwidth}{-2\cropspace}	% subtract the amount by which the image is cropped (only the image, not the text should be cropped)
	\addtolength{\commentwidth}{\lrdiffspace}	% add if cropping occurs only on one side
	
	\newlength{\commentspaceeven}
	\setlength{\commentspaceeven}{\commentspace}
	\addtolength{\commentspaceeven}{-\lrdiffspace}	% for even sides: the cropspace has to be inserted before the picture in order to shift it

	\sffamily
	\centering

	\landscapephoto{landscape.png}{M}
	\landscapephoto{landscape.png}{M}
	\portraitphoto{portrait.png}{M}
	\portraitphoto{portrait.png}{M}
\end{document}
