# How to vertically align 'subcaption' subfigures

I am using the \usepackage{subcaption} library (inspired by this) to create a figure with two images, like so:

\begin{figure}[H]
\centering
\begin{subfigure}{0.45 \linewidth}
\centering
\vfill
\includegraphics{2020.jpg}
\caption{A a $20\times 20$ image in original size.}
\end{subfigure} \hfill
\begin{subfigure}{0.54 \linewidth}
\centering
\includegraphics[height=6cm]{2020.jpg}
\caption{The same images with increased resolution, for illustrative purposes.}
\end{subfigure}


Giving me the following:

How do I vertically align the two images? I.e. I want something like this:

Use \subcaptionbox{<caption>}[<width>]{<image>} instead the subfigure environments, then you get the desired result, no trickery needed.

\documentclass{article}
\usepackage{graphicx}

\usepackage{subcaption}
\begin{document}
\begin{figure}
\centering
\subcaptionbox{%
A a $20\times 20$ image in original size.
}[0.45\linewidth]
{\includegraphics[width=1cm]{example-image-1x1}}
\hfill
\subcaptionbox{%
The same images with increased resolution, for illustrative purposes.
}[0.54 \linewidth]
{\includegraphics[width=5cm]{example-image-1x1}}
\end{figure}
\end{document}

• Exactly what I wanted! :-) It is also possible to add a normal caption to both images (not part of the question, but good to know) – Toke Faurby Oct 31 '17 at 7:39
• @TokeFaurby Do you mean what you get by adding \caption{ ... } after the second \subcaptionbox? – Torbjørn T. Oct 31 '17 at 9:03