I'd like to add a border to non-square images that will always make them square after resizing.
For example, I start with an image, original.jpg that's 3023x4321:
gm convert -size 3023x4321 xc:blue original.jpg
Ensure the longest dimension is maxed at 800, but I'd like to add a black border around the non-square resized image to ensure the final bordered image is 1000x1000:
gm convert -resize 800x800 -border 220x100 -bordercolor black original.jpg squared.jpg
The problem arises when I have an image with a different aspect ratio. In that case, -border 220x100 won't make the image square.
How can I make the -border flag always give me a square image after resizing and maintain the original aspect ratio?
-extentis better suited than-borderto make the image square: