magick input.png -trim +repage output.png

Category: Media & Conversion

magick input.png -trim +repage output.png

Trim blank borders automatically

Automatically removes uniform borders around the image edge and resets the canvas offset with +repage. Great for cleaning up screenshots with white margins. Add -fuzz 10% to trim borders that are nearly but not exactly one color.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.