Last Updated: February 25, 2016
·
1.182K
· bjeanes

Remove borders/frames from all images in a directory

If you have a bunch of images that look like:

but instead you want them all to look like:

Simply run the following*:

$ for pic in `ls -1 *.jpg`; do convert $pic -fuzz 2% -trim -trim +repage $pic; d

Depending on your photos' qualities, you may need to play with the -fuzz factor. I have two -trim options because my pictures have a white frame AND a black border. Each trim will remove one contiguous colour at a time.

<small>* Requires ImageMagick installed</small>