I have large squared figures. I want to align them to left or right edge of the page. In other words they should occupy inner/outer (or "centered" both margins)margin and also on top margin.
I'm aware of printing bleed risk.
Is there any automatic solution?
My primitive attepmts:
\documentclass{book}
\usepackage[demo]{graphicx}
\usepackage{changepage}
\usepackage{lipsum}
\newcommand{\adjustimg}{% Horizontal adjustment of image
\checkoddpage%
\ifoddpage\hspace{-4.5cm}\else\hspace{4.5cm}\fi%
}
\newcommand{\centerimg}[2][width=\textwidth]{% Center an image
\makebox[\textwidth]{\adjustimg\includegraphics[#1]{#2}}%
}
\begin{document}
\mbox{} \par \vspace*{-\dimexpr\paperheight-\textheight-1in-\voffset-\topmargin-\headheight-\headsep\relax}%<- calculaded top margin align
\noindent\centerimg[scale=0.5]{example-image-a}
\lipsum[2]
\newpage
\mbox{} \par \vspace*{-\dimexpr\paperheight-\textheight-1in-\voffset-\topmargin-\headheight-\headsep\relax}%<- calculated top margin align
\noindent\centerimg[scale=0.5]{example-image-b}
\lipsum[2]
\end{document}
Edit: Added top margin align: How to include a picture over two pages, left part on left side, right on right (for books)?

\includegraphicsrather than\centerimg? – Werner Sep 15 '21 at 17:27topmargin. – Simon Dispa Sep 15 '21 at 19:22