Page 1 of 1

Limit trim to one direction

Posted: 2008-11-20T10:31:09-07:00
by btnadiga
Using the command line, how would I trim (-trim) an image only say in x direction
Thanks a bunch,

Re: Limit trim to one direction

Posted: 2008-11-20T11:20:36-07:00
by fmw42
btnadiga wrote:Using the command line, how would I trim (-trim) an image only say in x direction
Thanks a bunch,
I don't think -trim allows directional control. The only way I can think of doing that is to use -extent to add a few pixels of different color on the two sides you want to preserve, then use -extend to add a few pixels of the same color on the side you want to trim so that the corner pixels are the color you want to trim, but the most of the other two sides are not that color. Then use -trim to remove the color you want on the one side and then follow that with -shave to remove the added other color on the other side.

The simplest way is just to measure and use -crop ... +repage

Re: Limit trim to one direction

Posted: 2008-11-20T18:42:33-07:00
by anthony
See IM Examples... One sided Trim...
http://www.imagemagick.org/Usage/crop/#trim_oneside

Re: Limit trim to one direction

Posted: 2008-11-21T10:24:10-07:00
by btnadiga
The problem is that I have a sequence of images where the object of interest moves. So manual cropping is not viable.

Actually, xv -acrop works great (except that I could not figure out how to make it save the cropped images without using the gui)

So, if one of you can tell me the optional parameters for Imagemagick that will emulate xv -acrop it would be perfect.

Thanks,
Balu

Re: Limit trim to one direction

Posted: 2008-11-21T12:00:44-07:00
by fmw42
btnadiga wrote:The problem is that I have a sequence of images where the object of interest moves. So manual cropping is not viable.

Actually, xv -acrop works great (except that I could not figure out how to make it save the cropped images without using the gui)

So, if one of you can tell me the optional parameters for Imagemagick that will emulate xv -acrop it would be perfect.

Thanks,
Balu

I don't believe there is one. See the two posts above as to how you have to script it.

or

trim all around and then pad back on the sides you want using -extent