Help combining two screenshots

Hey there! I've been mentally workshopping an automation in my head now for days and I can't figure out the right way to build it, so I've finally stopped lurking here and am asking for help.

What I want to do: combine two (or more) screenshots vertically. The Chrome plugin I take full-page screenshots with splits long pages into 2 or more images.

Essentially, the automation would:

  • Look at the dimensions of each image selected in the finder when I have all the screenshots selected
  • Get the width of the screenshots
  • Get the height of them and add those together
  • Create a new image with the dimensions of original width x total height
  • Overlay the screenshots onto the new images

I've seen automations in here handling vertically combining, but I can't figure out how to reverse engineer it to my needs or which actions are needed for everything but the last step.

Any help would be so appreciated!

I've seen some related topics, one way to solve it is using a third party app like SnagIt.
If you have Firefox, there's a screenshot app that captures full page screenshots:

EDIT: The author also offers a Chrome extension:

Take a look at the very first answer in Macro to Combine Arbitrarily Sized Images in which I recommend using Imagemagick (a separate install) and its convert command in an Execute Shell Script action:

convert ss-1.png spacer.png ss-2.png +append ss-combined.png

That builds the combined image horizontally. To build it vertically without a spacer:

convert ss-1.png ss-2.png -append ss-combined.png

Simple as that. If you install Imagemagick, that is.