Hi guys,
I am using the trim function in order to get rid of a background surrounding a product image. However, the trimming sometimes cut too much, and I would like to know if there is a way of giving trim the option to say, give 2px of margin from wherever you were gonna cut to.
I haven't been able to found that on the docs, so I thought you guys could have any ideas.
Thanks
Trim with limitations
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Trim with limitations
You can get the trim bounds by
identify -format "%@" yourimage
put that into a variable or separate into the needed variables. Then add whatever extra you want. Then use -crop WxH+X+Y +repage to crop it with your modified trim variables for W,H,X,Y.
see
http://www.imagemagick.org/script/escape.php
identify -format "%@" yourimage
put that into a variable or separate into the needed variables. Then add whatever extra you want. Then use -crop WxH+X+Y +repage to crop it with your modified trim variables for W,H,X,Y.
see
http://www.imagemagick.org/script/escape.php