use a new strategy for computing the baseline for the various beside functions

Instead of just taking the maximum  value of any of the baselines in the
beside case, look for the largest difference between the bottom and
the baseline and take the location of that image's baseline as the combined
baseline. If the differences are equal, take the one that is furthest away
from the top

closes PR 14760