Page 1 of 1

Resize image, keep aspect ratio and add white background

Posted: 2020-02-21T08:44:55-07:00
by sakis_s
Hi! I've tried so many different things but nothing really works for me. Can someone please help me?

I have many .jpg images inside a folder all 1448x2048 pixels. I'm trying to convert all of them to 1050x1200 pixels and add white background to keep the aspect ratio. I'm using ImageMagick for windows.

Any ideas are much appreciated.

Re: Resize image, keep aspect ratio and add white background

Posted: 2020-02-21T11:22:24-07:00
by fmw42
What is your version of Imagemagick?

For IM 6:

Code: Select all

convert image -resize 1050x1200 -gravity center -background white -extent 1050x1200 newimage
For IM 7, replace convert with magick

Re: Resize image, keep aspect ratio and add white background

Posted: 2020-02-21T14:35:33-07:00
by sakis_s
fmw42 wrote:
2020-02-21T11:22:24-07:00
What is your version of Imagemagick?

For IM 6:

Code: Select all

convert image -resize 1050x1200 -gravity center -background white -extent 1050x1200 newimage
For IM 7, replace convert with magick
Thank you so much fmw42! Based on your command i was able to change some things for multiple images of a folder and finally i used this:
mogrify -path c:/test -resize 1050x1200 -background white -gravity center -extent 1050x1200 *.jpg
Works perfectly! :D