# resize and pad image with transparency convert -background none -gravity center image.png -resize 400x400 -extent 400x400 result.png