Common ImageMagick Terminal Commands for Developers

Enjoy Quick Image Editing


Center image inside larger canvas

convert input.jpg -gravity center -background white -extent 50x50 output.jpg

Print Image Info (Mac/Linux)

file example.png

Convert Image Type

convert example.png example.jpg

Crop Image

convert foo.png -crop 640x480+50+100 out.png

Crop Image from Center

convert example.png -gravity center -crop 25x25+0+0 example.png

Resize Image (keep aspect ratio)

convert example.png -resize 200x100 example.png

Resize Image (ignore aspect ratio)

convert example.png -resize 200x100! example.png

Resize by Width (keep aspect ratio)

convert example.png -resize 200 example.png

Resize by Height (keep aspect ratio)

convert example.png -resize x100 example.png

Rotate Image

convert example.jpg -rotate 90 example-rotated.jpg

JPG Compression Level

convert example.png -quality 95 example.jpg

Combine Commands

convert example.png -resize 400x400 -rotate 180 -charcoal 4 -quality 95 example.jpg

Batch Processing

for file in *.jpg; do convert $file -resize 900x600 2x-$file; done

Download Image from URL

curl -O http://example.com/images/example.jpg

A set of UI components for React Native.
Get Carbon Native!