My Favorite ImageMagick Convert Commands

Manipulate images from the command line.

ImageMagick is an amazing CLI image manipulation utility I have been using for 20 years. Here are some of the common PNG/JPG/etc commands I use.

Add solid background to the image

While keeping the original contents in the center. You need to know the output width / height. For example to make the output image width 600 pixels with white border on both sides use the command

convert input.png -background white -gravity center -extent 600 output.png

Combine several images into one row

Use +append to create a single row. Use -append to create a column.

convert image1.png image2.png image3.png ... +append output.png

Compute average image color

See Give browser a chance blog post.