Goal: to trim counter edges.
- ImageMagick docs, Crop relative to Gravity, https://www.imagemagick.org/Usage/crop/#crop_gravity;
- ImageMagick docs, Shave, removing edges from an image, https://www.imagemagick.org/Usage/crop/#shave.
If all images have same width and heigth it is perfectly OK to "trim from outside" i.e. instruct ImageMagick to remove border of specific width:
magick <input-file> -shave WxH <output-file>
If images don't have same width and height (i.e. you have auto-cropped counters from counter sheets), trimming them from outside could possible result with non-uniform-sized output. In such case it is better to "crop from inside":
magick <input-file> -gravity center -crop WxH+0+0 <output-file>