Dave's Brain

Browse - 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.

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.