Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi All, I'm facing an issue where imagesharp resizes an image and it sometimes ends up sideways. If I set format=webp then it's sideways (or upside down. if format=jpg it's correct
I believe it's something to do with EXIF orientation metadata. This document seems relevant: https://docs.sixlabors.com/api/ImageSharp/SixLabors.ImageSharp.Processing.AutoOrientExtensions.html
If you want some example images download a the zip file from this page: https://www.galloway.me.uk/2012/01/uiimageorientation-exif-orientation-sample-images/
And the answer is:
Add autoorient=true to the query string, or automatically to all image processor tasks like so:
autoorient=true
public class ConfigureImageSharpMiddlewareOptionsComposer : IComposer { public void Compose(IUmbracoBuilder builder) => builder.Services.Configure<ImageSharpMiddlewareOptions>(options => { // Capture existing task to not overwrite it var onParseCommandsAsync = options.OnParseCommandsAsync; options.OnParseCommandsAsync = async context => { // Custom logic before context.Commands.Add("autoorient","true"); await onParseCommandsAsync(context); // Custom logic after }; }); }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
ImageSharp processing images end up rotated sideways
Hi All, I'm facing an issue where imagesharp resizes an image and it sometimes ends up sideways. If I set format=webp then it's sideways (or upside down. if format=jpg it's correct
I believe it's something to do with EXIF orientation metadata. This document seems relevant: https://docs.sixlabors.com/api/ImageSharp/SixLabors.ImageSharp.Processing.AutoOrientExtensions.html
If you want some example images download a the zip file from this page: https://www.galloway.me.uk/2012/01/uiimageorientation-exif-orientation-sample-images/
And the answer is:
Add
autoorient=true
to the query string, or automatically to all image processor tasks like so:is working on a reply...