SixLabors / ImageSharp.Web

:globe_with_meridians: High Performance Image Processing Middleware for ASP.NET- Core.
https://sixlabors.com/products/imagesharp-web/
Other
423 stars 101 forks source link

ImageSharp Web does not appear to handle rotation during format change to WEBP #304

Closed jaddie closed 1 year ago

jaddie commented 1 year ago

Prerequisites

ImageSharp.Web version

2.0.3

Other Six Labors packages and versions

2.1.3

Environment (Operating system, version and so on)

Linux

.NET Framework version

7

Description

When transforming an image from JPG to WEBP the rotation of the image does not appear to be preserved, even when using AutoOrient. Not sure what other information might be useful, running through an Umbraco 11 site. The rotation is handled perfectly when format is set to JPG, but when it is WEBP the image does not show the correct rotation based on metadata.

Steps to Reproduce

Process an image which has rotation applied, change format to WEBP, observe the image being the unexpected rotation as a result

Images

c06d876e-9a0e-420e-a714-e35114d2a4e6

jaddie commented 1 year ago

I have run jhead against the source image using -autorot to modify the JPG to be saved in rotated format instead of in the EXIF data & the file now can be transformed by ImageSharp.Web to webp format without an issue

JimBobSquarePants commented 1 year ago

jhead is performing a lossless rotation of the image pixels using jpegtran. That's not the same thing.

The EXIF orientation metadata is preserved well enough. WebP is simply not supported well in browsers for some reason.

https://zpl.fi/exif-orientation-in-different-formats/

JimBobSquarePants commented 1 year ago

the rotation of the image does not appear to be preserved, even when using AutoOrient.

I'm not sure what this means.

AutoOrient will read the EXIF profile and rotate the image pixel to normalize them stripping the EXIF data after.

What commands are you passing?

JimBobSquarePants commented 1 year ago

I'm closing this. ImageSharp.Web is correctly applying the EXIF orientation. Browser support is what is lacking.