Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to resize image using ImageMagick

📅 2013-Jun-02 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ convert, imagemagick, mogrify, rescale, resize ⬩ 📚 Archive

ImageMagick provides convenient command-line tools for processing images. One common operation that I need is to resize or rescale images down to a certain height, width or percent.

To resize an image down to a width of 1024 pixels:

$ mogrify -geometry 1024x foo.jpg

To resize an image down to a height of 800 pixels:

$ mogrify -geometry x800 foo.jpg

To resize an image such that the longest side (either width or height) is 800 pixels:

$ mogrify -geometry 800x800 foo.jpg

To resize an image down by half:

$ mogrify -resize 50% foo.jpg

Tried with: ImageMagick 6.7.7-10 and Ubuntu 14.04


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧