I have an image example.png, which is 50x50 pixels, mostly transparent and some black shape. What I want to achieve with imagemagick is, create a new image, example_output.png, which would be 100x100 pixels with transparent background and original 50x50 image in the center. Is this doable? How?

2 Answers 2


Check out the extent operation:

convert example.png -gravity center -background none -extent 200%x example_output.png

If you have a 100x100 transparent image already, you can do this:

convert 100x100.png 50x50.png -geometry +25+25 -composite x.png

Otherwise, create the 100x100 first, then add the original:

convert -size 100x100 xc:none 100x100.png
convert 100x100.png 50x50.png -geometry +25+25 -composite x.png

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.