We are using image croppers and convert our images to webp. This is done by using a static helper class which we used in many projects before. However, there are some pictures which are just randomly rotated by 90 degrees.
It seems like this has something to do with exif data, since it was taken on a mobile phone and then rotated there.
Our Helper looks like this:
public static class ImageHelper {
public static string? GetOptimisedCropUrl(this IPublishedContent? image, string crop) {
if (image == null) {
return null;
}
// return image with set crop if crop is set
if (!string.IsNullOrWhiteSpace(crop)) return image.GetCropUrl(crop) + "&format=webp";
// else, get image height and width and set as crop
var imageHeight = image.GetProperty("umbracoHeight")?.GetValue()?.SafeCast<int>();
var imageWidth = image.GetProperty("umbracoWidth")?.GetValue()?.SafeCast<int>();
// if image is larger than 2560 x 1440, set large crop
if (imageHeight is >= 1440 && imageWidth is >= 2560) {
return image.GetCropUrl("LargeImageCrop") + "&format=webp";
}
return image.Url() + "?width=" + imageWidth + "&height=" + imageHeight + "&format=webp";
}
}
We tried a couple of settings from Processing Commands like orient or compand, but it does not change anything.
Is there any way to remove exif data or otherwise solve the rotation problem without installing any sort of addon/extension?
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/112324-crops-with-webp-remove-exif-data