sobota, 11 maja 2013

How to crop an area in multiple images

I have run into this problem today. I wanted to cut out a specific area from a hundred pictures in one directory. I use Ubuntu as my desktop OS. As it usually happens with my beloved Linux, there is a handy way of doing this.

ImageMagick set of tools lets you do magic with images. There is a CLI (command line interface) set of commands available and one of them is convert, which helps you change a picture. To crop an area, you use -crop option. There is also mogrify command  to batch process the files. And the following command did the trick:

$ mogrify -crop 300x300+950+500 *jpg

It has cut out the area of 300 pixels x 300 pixels with the upper left corner located at the point 950 pixels to the right and 500 pixels down from the original upper left corner of the picture. It has processed all the images in the directory.

Brak komentarzy:

Prześlij komentarz