Enjoy Quick Image Editing


Add text to image

convert input.png \
-gravity north \
-pointsize 90 \
-font Arial \
-fill white \
-annotate +0+100 'Multiple Accounts' \
output.png

Add drop/box shadow to image

convert input.png \
\( -clone 0 -background gray -shadow 80x3+10+10 \) \
\( -clone 0 -background gray -shadow 80x3-5-5 \) \
-reverse \
-background none \
-layers merge +repage \
output.png

Center image inside larger canvas

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

Change background color

convert foo.pdf -background "#eee" -flatten foo.jpg

Replace color with transparency

foo.png -fuzz 25% -transparent red bar.png

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