Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImageMagick command to enlarge original image

Tags:

imagemagick

I have a canvas.png image which is 2048 x 2048 px. I have a background.jpg image which is 1920 x 1080 px.

I want to increase the size of the background.jpg and place it on canvas.png, it must fill the whole area but background.jpg should remain in proportion.

When the two images are composed I want to retain the original canvas size of 2048 x 2048 px

canvas.png

background.jpg

like image 304
Joe Ainsworth Avatar asked Sep 14 '25 12:09

Joe Ainsworth


1 Answers

If you do not want to modify the aspect ratio, you can try:

convert background.jpg  -resize 2048x2048^ -gravity center -extent 2048x2048  fill_background.jpg

It gives: enter image description here

like image 153
xiawi Avatar answered Sep 17 '25 19:09

xiawi