Page 1 of 1

Trim canvas to only fit image?

Posted: 2008-04-09T13:02:50-07:00
by vbsaltydog
I have a series of images, each one sits on a 300x300 white background and are centered on the x and y axis.
I need to trim down the white background or "canvas" so that it is cropped tightly around the image ... say 10px padding.

The problem is that all of the images on the backgrounds are different sizes in regard to width and height so I can't pass coordinates to the crop command. Is there a way to auto detect where the image is on the background canvas and then autocrop around the image?

Re: Trim canvas to only fit image?

Posted: 2008-04-09T13:14:22-07:00
by fmw42

Re: Trim canvas to only fit image?

Posted: 2008-04-09T14:30:15-07:00
by vbsaltydog
Thank you. Trim worked perfetly. I thought it would only remove borders of colors dissimilar from the background.

Thanks again.

Re: Trim canvas to only fit image?

Posted: 2008-04-09T17:01:20-07:00
by fmw42
if you add -fuzz somevalue% -trim then it will trim using fuzzy values, i.e. the color does not have to be exact