I think you can get what you want by redefining the appropriate blocks in your template.
In document_contents.tplx
, note that blocks data_png
, data_jpg
etc all call the same macro draw_figure
.
I did something similar to what you're after by redefining the figure blocks in my custom template to call a different macro draw_figure_2
which I also defined in my custom template.
Adding something like
((*- block data_png -*))((( draw_figure_2(output.metadata.filenames['image/png']) )))((*- endblock -*))
((*- block data_jpg -*))((( draw_figure_2(output.metadata.filenames['image/jpeg']) )))((*- endblock -*))
((*- block data_svg -*))((( draw_figure_2(output.metadata.filenames['image/svg+xml']) )))((*- endblock -*))
((*- block data_pdf -*))((( draw_figure_2(output.metadata.filenames['application/pdf']) )))((*- endblock -*))
% copied macro draw_figure and made some naive changes; modify as needed
((* macro draw_figure_2(filename) -*))
((* set filename = filename | posix_path *))
((*- block figure scoped -*))
\begin{figure}[h] % or whatever you want
\begin{center}
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{((( filename )))}
\end{center}
\end{figure}
{ \hspace*{\fill} \\}
((*- endblock figure -*))
((*- endmacro *))