Page 1 of 1

How to automatically crop a picture

Posted: 2010-01-03T09:20:40-07:00
by projetmbc
Hello,
I have a picture with a white background. I would like to find the minimal rectangle around the picture, more precisely the rectangle must start at the first non white pixels.

Here is a way to do that with imagemagick ?

Re: How to automatically crop a picture

Posted: 2010-01-03T12:43:00-07:00
by Bonzo

Re: How to automatically crop a picture

Posted: 2010-01-03T15:45:02-07:00
by fmw42
I don't think -trim will guarantee that the rectangle starts with the first non-white pixel. Say you have a black circle in a white background. Then -trim will have a minimum size image that has white in the top left corner, but has back at the center of the sides of the circle.

Please clarify your request further. Or present an example (diagram or image) that you think shows what you want!

You may also want to look at my scripts, autotrim and trimmer. see link below