This macro allows you to automate the cropping of images in a customizable manner. To that end, among other things it makes use of com.sun.star.text.GraphicCrop. Note that simply changing the
.GraphicCrop of an image does not execute smoothly, which is why the below macro adjusts the position and size of the image so that it is static and not compressed or stretched after execution of the macro. The macro is also designed to take into account previously applied cropping values to the image, so you can execute the macro multiple times on the same image.