How can I center a PNG with a transparent background using the CLI?
Background

I've used ImageMagick in the past to do pretty extensive image manipulations from the CLI. I've written about it extensively here on the Unix &amp; Linux StackExchange site.

Specifically, here's a method I highlighted in this question titled: How to convert, resize and center image with ImageMagick.

Approach

The approach discussed there could be adapted to achieve a solution to this question like so:

$ convert 807634040.png \
    -gravity center \
    -background transparent \
    -extent 678x 807634040-new.png


Resulting in an image like this:



How it works

The convert command is expanding the original image, 807634040.png, so that its width is now 678 pixels. This looks to be the optimal size to use when posting images on SE sites. The -extents 678x means to use the width of 678px but leave the horizontal as whatever it was originally set.

The other options mean to center the image (-gravity center) and to use a transparent background when extending the original.