How to trim screenshots via the commandline

I just had to trim a bunch of screenshots that had some black borders around them. I didn’t want to do this manually or via a GUI, but ideally batch-able via the commandline. Thankfully, that’s one of the many things that ImageMagick can do for you. I put all my screenshot PNGs into a folder, and then in that folder ran this mogrify command: magick mogrify -trim -define trim:percent-background=0% -background black -path output/ *....

February 9, 2023 · 1 min
Mastodon