Is there any way to achieve the equivalent of CSS "object-fit: cover" for images?
I am adding images to a page (1 to 6, which the user decides). The layout is decided depending on the number of images. For example, if the user chose 4 images, each image occupies one quarter of a page (either portrait or landscape, again decided by the user). The images should fill their respective "bounding boxes" without getting distorted. The SetSize method of an image distorts the image and SetBounds method doesn't necessarily fill the box (it acts like object-fit: contain).
Is there any way to make the image fill a given area without getting distorted? I understand that this may crop the image, but that's OK.
I also wrote code to resize the image to fill an area by maintaining aspect ratio, but I don't see any option to restrict them to the area. I also tried adding the image to properly sized and placed ContentArea, but the image overflows the area.
Any help is highly appreciated.