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";
}
}
Crops with webp, remove exif data
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:
We tried a couple of settings from https://docs.sixlabors.com/articles/imagesharp.web/processingcommands.html 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?
I had the same issue when trying to use but just gave up and removed the format :) then they flip correctly. Not much help I'm afraid.
is working on a reply...