Thursday, 18 July 2013

Mogrify : An ImageMagic command line tool for various Image operation in Ubuntu

Mogrify is the command line tool from ImageMagic and used to do various image operation from terminal. So it is widely prefer by the designer who need to do batch operation. I came to know about this tool when I need to scale, change the quality and to change the format of the number of images during my Android development. In Android, you need to build 4 types of images of this ratio 3:4:6:8. So it helps me a lot.

Hence I'm writing some useful commands and provide reference to their guide for detailed imformation.

Resize an image : 
  • mogrify -resize 75% image.jpg     [resize it to 75% of its current resolution]
  • mogrify -resize 256x256 image.jpg     [resize it by 256x256 of fix resolution]

Change the format of an image : 
  • mogrify -format png image.jpg     [convert image.jpg to image.png]
  • mogrify -format png *     [covert all image to png format in current directory]

Change the quality of jpg image : 
  • mogrify -quality 50 image.jpg     [downgrade the quality of image by half]

Rotate an image : 
  • mogrify -rotate 90 image.jpg     [rotate image clockwise by 90 degree]

Strip metadata and comments : 
  • mogrify -strip image.jpg     [use to strip all metadata - mainly used to reduce the physical size of an image]


There are many others command which used to do other things with images. The main benefit of this tool is that you can easily use it for batch processing using * at place of your image name. It takes all the files in present directory.

Here is the reference where you can find each command with detail.

Mogrify : http://www.imagemagick.org/script/command-line-options.php




2 comments: