Page 1 of 1

Trim Bounding Box Center

Posted: 2015-06-09T07:36:28-07:00
by checksumfail
The command:

Code: Select all

convert image.jpg -fuzz 50% -format "%@" info:
Gives you the details of how many pixels would be trimmed horizontally and vertically if you were to use trim, this is great as it allows you to do modify these numbers to do a trim that leaves a slight border.

However, It doesn't give you the center of this bounding box, it gives the new image size, the total of the horizontal/vertical pixels that would be trimmed away but not how much on the left vs on the right etc.

Is it possible to also get the co-ordinates of the center of the trim box?

Re: Trim Bounding Box Center

Posted: 2015-06-09T07:45:18-07:00
by snibgo
-format "%@" gives the new width and height, and coords of top-left corner. This is as required for the "-crop" operation. For the centre, add half the width or height to the top-left coord.