I add a background image to every page and want to add a different one based on the name of the current chapter. It would also be good to know how whether the preface and title pages before the chapters start need their own treatment.
I unsuccessfully tried:
\documentclass{book}%
\usepackage[T1]{fontenc}%
\usepackage{graphicx}%
\AddToHook{shipout/background}{\put(0pt, -\paperheight) {\includegraphics[width =\paperwidth, height =\paperheight]{\chaptermark}}}%
%
\begin{document}%
\chapter{example-image}
x
\end{document}
\setchapterimage{<image>}
at the start of the\chapter
...