User Tools

Site Tools


notes:batch-image-processing

Command Line Batch Image Processing with mogrify

To process a single file you can use convert. For example, to reduce the quality of a jpg image you can run

convert -quality 75 file.jpg

or

mogrify -quality 75 file.jpg

However, to apply to same action to all the jpg images in a directory you have to run mogrify. This tool is similar to convert except the original image file is overwritten with any changes. Batch convertion with mogrify is quite straightforward:

mogrify -quality 75 *.jpg

If you want to run your batch operation recursively to all subdirectories you can run

find . -name '*.jpg' -execdir mogrify -quality 75 {} \;

A list of all (more than 200!) convert/imagemagick options is available at http://www.imagemagick.org/script/convert.php

notes/batch-image-processing.txt · Last modified: 2014/10/23 07:57 by admin