Page 1 of 1
Crop borders
Posted: 2017-02-28T13:42:35-07:00
by CSharpCoder
How do I crop an image at its center, so that it gives the image a certain size while only cutting the borders away (no scaling)? OR how do I give it borders that gives the image a certain total size?
The best I got right now is
but it crops at the upper left corner, which is not what I want.
Re: Crop borders
Posted: 2017-02-28T14:12:53-07:00
by snibgo
"-crop" should usually have offsets for the top-left (or center etc) of the crop, eg:
Code: Select all
-crop 180x152+0+0
-crop 180x152+23+34
See
http://www.imagemagick.org/script/comma ... s.php#crop
What version IM do you use? On what platform?
Re: Crop borders
Posted: 2017-02-28T14:24:56-07:00
by CSharpCoder
Solved it. Don't use crop.
extent was what I was looking for. Although you have to apply it to the center (-gravity center) and set the background as transparent (-background none)
Code: Select all
-background none -gravity center -extent 180x152