I just installed ImageMagick (new to Terminal) and can't figure out how to bulk crop a folder of pngs to remove all transparent space around the png (i.e. a square logo on a rectangle png with transparent area that can be cropped)

I am trying to take all the pngs and output them into a different folder called out.

What is the command?


To trim a single image:

convert /path/to/original.png -trim +repage /path/to/out/trimmed.png

To trim each png in a folder:

cd /path/to/folder
mkdir ../out
for f in ./*.png; do
  convert "$f" -trim +repage "../out/$f";
|improve this answer|||||

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .