ImageMagick Tricks

root's picture

How to resize all images in a directory:

root@linux:~# for i in `ls *.jpg`; do convert -resize 1280x960 $i $i; done

How to convert all bmp images to jpg:

root@linux:~# for i in $(ls); do convert $i `basename $i .bmp`.jpg; done

How to combine 3 images to one in horizontal (use [i+append[/i] for vertical):

root@linux:~# convert -append 1.jpg 2.jpg 3.jpg 1-2-3.jpg

How to create animated gif from static images (-delay is the framerate):

root@linux:~# convert -delay 4 *.JPG output.gif

How to resize an image to width of 200, but keeping the same aspect ratio:

root@linux:~# convert source.jpg -resize 200x target.jpg

How to resize an image to height of 200, but keeping the same aspect ratio:

root@linux:~# convert source.jpg -resize x200 target.jpg

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content