Imagemagick for batch processing of images

Imagemagick can apply a number of different filters at a time. In combination with the linux pipes it is possible to batch process a huge number of images.

The command below takes all images in the “data” directory and does the following steps:

  • Resize to 400×300 pixels
  • Transform to gray color
  • Apply a sepia effect to give the image an “old” style
  • Change (brightness,saturation,hue) from (100,100,100) to (100.35,100)

ls data/ | xargs -I {} convert data/{} -resize 400×300 -colorspace gray -sepia-tone 81% -modulate 100,35,100 -quality 60 {}.jpg