Sunday, August 7, 2011

Image Manipulation in Ubuntu with ImageMagick Tools

Can't believe I haven't come across convert and mogrify before now. Much time could have been saved in the past.

I used Ubuntu 10.04 Lucid for this, but I doubt it matters much as long as you have a recent Linux distribution.

sudo apt-get install imagemagick

Example: resize an image to fit in a 100x100 pixel box, and place it in the centre of a 100x100 pixel box:

convert foo.png -resize '100x100' \
  -background transparent \
  -gravity center \
  -extent '100x100' \

Lots more good documentation here.

No comments: