The important thing to remember is that ImageMagick will keep the aspect ratio unless you tell it not to with the “!” option.
So the command to add a left and right border to an image is this:
magick convert -border 2000x! old.jpg new.jpg
To break that down:
convert the file into a new image file.
2000 add 2000 pixels to left AND right side of image
x! height is not specified here. The
! tells ImageMagick to not preserve the aspect ratio.
Similarly, in order to add to the top and bottom of the photo, I use this command:
magick convert -border !x2000 old.jpg new.jpg