Using the command line, how would I trim (-trim) an image only say in x direction
Thanks a bunch,
Limit trim to one direction
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Limit trim to one direction
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.btnadiga wrote:Using the command line, how would I trim (-trim) an image only say in x direction
Thanks a bunch,
The simplest way is just to measure and use -crop ... +repage
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Limit trim to one direction
See IM Examples... One sided Trim...
http://www.imagemagick.org/Usage/crop/#trim_oneside
http://www.imagemagick.org/Usage/crop/#trim_oneside
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Limit trim to one direction
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
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
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Limit trim to one direction
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