Solution 1:

ImageMagick can do this:

convert 1.png 2.png -append result.png

Alignment options can be (optionally) specified using the -gravity switch,

  • -gravity East align the right edges
  • -gravity West align the left edges
  • -gravity center align the centers

Note: using +append instead of -append will stitch the images together horizontally, i.e. side-by-side rather than one above the other.