Wide images getting cut on resizing

Vote:
 

Hi, We are on Episerver version 12.26.0 and using Baaijte.Optimizely.ImageSharp.Web v2.2.2 package for resizing images on the website. But for wider images, having dimensions eg. 1920 x 430px or 1053 x 440px, the images get cropped when resizing to 880 x550 px. The same code works fine for other rectagular or square images.

If I pass 1280 width when resizing these images and resize method crop, then they render as expected. 

We have common code for all languages, how can we ensure that these images don't actually get cut? Can we pass width and height parameter relative to every image?

#328830
Edited, Sep 05, 2024 11:36
Vote:
 

Hi Prianka. If you want the image to maintain its aspect ratio, then just set width.
https://docs.sixlabors.com/articles/imagesharp.web/processingcommands.html#resize

Note that "crop" is not used for ImageSharp (but it was for ImageProcessor used in Episerver 11).

Maybe you want to use this:
https://hacksbyme.net/2022/08/16/optimize-images-on-your-optimizely-cms-site/

#329456
Sep 06, 2024 13:06
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.