abbassix
abbassix

Reputation: 645

How to remove alpha channeled margins from an image using ImageMagick

I have an image that all four margins are transparent alpha channels and I want to crop all margins and only keep the non-alpha channel parts. Is there any way to do it with ImageMagick? Take this image as an example but consider its transparent margins!

an image with alpha channel margins

Upvotes: 0

Views: 185

Answers (1)

fmw42
fmw42

Reputation: 53237

You can do that in Imagemagick using -trim to automatically remove the constant transparent regions.

convert img.png -trim +repage result.png

enter image description here

Upvotes: 1

Related Questions