Auto-cropping

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
michaelmuller

Auto-cropping

Post by michaelmuller »

I've looked through the documentation and can't find anything that will autocrop an image.

For example, a 500px X 500px file that has only a 100px X 100px logo near the bottom left on a white background.

Anyway for the utility to auto-find the top, left, right and bottom edges of image data within a larger file?

Thanks.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Auto-cropping

Post by Bonzo »

-trim would work for the logo on a white background example you quoted.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Auto-cropping

Post by fmw42 »

add -fuzz XX% -trim

if the background is not pure white.

also see my autotrim script at the link below
Post Reply