Imagemagick Usage Examples

Imagemagick we use to embed logos into our photos, create animations of a series of thumbnails, crop photos to automatically fit into a preview window and to resize / compress images so that they're not so large when on our server.

To resize an image to a 120 by 80 pixels JPEG with the compression level set to 50% use the following code:

/path/to/convert -resize 120!x80! -quality 50 '$source_image' '$destination_image'

To embed a graphic, like a Watermark or a Logo, into an image use the following code:

/path/to/composite -blend 50 '$source_logo_or_watermark' + '$source_image' '$destination_image'

Sometimes its neccesary to Blur an image before we resize it, so that the colors blend nicely to cause an anti-aliasing effect, which removes jagged edges from resizes images. To Blur an image slightly you must do the following:

/path/to/convert -blur 10x1 -quality 100 '$source_image' '$destination_image'

The amount we Blur the image depends on the dimensions of the image and the amount by which you wish to resize. If your source image is only 150pixels wide and you wish to resize it to 100pixels wide then the blur amount need only be very slight so we might use:

/path/to/convert -blur 2x1 -quality 100 '$source_image' '$destination_image'

Additional information