I have a lot of figures to put side by side in a document, and they are all slightly different in size (i.e. not all 4:3 format or so).
What I'm doing at the moment is tweak the width=0.XX\textwidth of both until they look more or less the same height.
Here I provide an example code: what I would like to be able to do is have a macro or something, where I can simply provide the two figures and they automatically scale to have the same height and fit on one line. Is that possible? And if yes, how?
Edit: since people are asking why I'm not providing specific sizes for the images: The code should work with any 2 images with any aspect ratio. Give it two images and the code scales them to fit side by side and have the same height, filling the horizontal space available.
\documentclass{scrreprt}
\usepackage{subfig}
\usepackage{graphicx}
\begin{document}
\chapter{Figures}
\begin{figure}[h!]
\centering
\subfloat[Figure one]{%
\centering\includegraphics[width=0.45\textwidth]{example-image-a}}
\qquad
\subfloat[Figure two with different side proportions]{%
\centering\includegraphics[width=0.45\textwidth]{example-image-16x9}}
\caption{How to get the two figures to same height (respecting proportions)?}
\end{figure}
\end{document}
What I get:
What I wish to happen automatically:




