Programming Tips - How can I resize a series of images with different aspect ratios to the same size with letter boxing?

Date: 2016apr26 Product: ImageMagick Q. How can I resize a series of images with different aspect ratios to the same size with letter boxing? A. Assuming you are going to 1280x720, for each file do:
convert $filein -resize 1280x720 -background black -gravity center -extent 1280x720 $fileout
This first resizes the image to a size that will fit into 1280x720. Then puts it on a black background that's 1280x720.