
My Favorite ImageMagick Convert Commands
Published on February 21, 2024
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
1 |
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.
1 |
convert image1.png image2.png image3.png ... +append output.png |
Compute average image color
See Give browser a chance blog post.