I ended up writing a little script.
Append two images horizontally and match to the minimum height:
h1=$(identify -ping -format "%h" 1.jpg) &&
h2=$(identify -ping -format "%h" 2.jpg) &&
min_h=$(( h1 < h2 ? h1 : h2 )) &&
convert 1.jpg -resize x$min_h\> 1_shrink.jpg &&
convert 2.jpg -resize x$min_h\> 2_shrink.jpg &&
convert +append 1_shrink.jpg 2_shrink.jpg out.jpg &&
rm 1_shrink.jpg 2_shrink.jpg
Append two images vertically and match to the minimum width:
w1=$(identify -ping -format "%w" 1.jpg) &&
w2=$(identify -ping -format "%w" 2.jpg) &&
min_w=$(( w1 < w2 ? w1 : w2 )) &&
convert 1.jpg -resize $min_w\> 1_shrink.jpg &&
convert 2.jpg -resize $min_w\> 2_shrink.jpg &&
convert -append 1_shrink.jpg 2_shrink.jpg out.jpg &&
rm 1_shrink.jpg 2_shrink.jpg
If you want to match to the maximum dimension of the two images, just change the condition in parentheses from <
to >
.