How To Batch Letterbox Images with Imagemagick

Letterboxing

To be able to run the command below you'll need to install a utility called ImageMagick. This command will take an input image and letterbox it into a 4:3 aspect ratio with black borders

magick INPUT.JPG -set option:wd "%[fx:(4/3)>(w/h)?(4/3*h):w]" -set option:ht "%[fx:(4/3)>(w/h)?h:(w/(4/3))]" -gravity center -background black -extent "%[wd]x%[ht]" OUTPUT.JPG

Batch Letterboxing at the Windows Command Line

This command will letterbox all JPG files in the active directory into 4:3 aspect ratio images with black borders

for %i in (*.jpg) do magick %i -set option:wd "%[fx:(4/3)>(w/h)?(4/3*h):w]" -set option:ht "%[fx:(4/3)>(w/h)?h:(w/(4/3))]" -gravity center -background black -extent "%[wd]x%[ht]" %i

References