ImageSharp.Web icon indicating copy to clipboard operation
ImageSharp.Web copied to clipboard

WebP encoding not honouring the Exif orientation data?

Open robertjf opened this issue 1 year ago • 4 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have verified that I am running the latest version of ImageSharp.Web
  • [X] I have verified if the problem exist in both DEBUG and RELEASE mode
  • [X] I have searched open and closed issues to ensure it has not already been reported

ImageSharp.Web version

3.1.3

Other Six Labors packages and versions

SixLabors.ImageSharp 3.1.5

Environment (Operating system, version and so on)

Umbraco 13.4.1, Umbraco Cloud

.NET version

8

Description

We have come across an image or two that behave strangely when the webp format is applied in the query string to manipulate the image:

image

In order to test with the latest version of ImageSharp/ImageSharp.Web I have applied the latest versions of the NuGet packages to the project. The original versions were 3.1.3 and 3.1.0 respectively.

This is the URL for the image on the left:

https://youritteam.com.au/media/wzpnn4zs/image-5.jpeg?width=800&height=1067&format=webp&quality=70&v=1dadd68d1c2e900 (broken)

And this is the same URL without the webp format applied, which renders in the correct orientation:

https://youritteam.com.au/media/wzpnn4zs/image-5.jpeg?width=800&height=1067&quality=70&v=1dadd68d1c2e900

The original image is below (it's possible the copy on the website will be replaced soon).

Steps to Reproduce

Host the sample image and render it with the format=webp (no other parameters are required) on the URL.

Images

exif-webp-issue

robertjf avatar Jul 25 '24 07:07 robertjf

See https://github.com/SixLabors/ImageSharp.Web/issues/375

It's the browser. It doesn't respect the EXIF metadata

JimBobSquarePants avatar Jul 25 '24 07:07 JimBobSquarePants

Hm. Given that this is the case, is there an option to ignore exif when applying WebP as a way around this?

robertjf avatar Jul 25 '24 07:07 robertjf

No, you can't really ignore the format like that.

You could inject your own version of AutoOrientWebProcessor that only operates if the format is WebP or you intend to convert to WebP though. You would ensure it always runs first by injecting a command via OnParseCommandsAsync

JimBobSquarePants avatar Jul 25 '24 10:07 JimBobSquarePants

@JimBobSquarePants i think my issue is related to this see here https://therattlecat.com/1/Blogs/IMG-5811ahfJI8E57qnQBJD.jpeg?&format=webp&quality=80&w=850&bgcolor=ffffff

can you give me a sample of how i need to apply my own AutoOrientWebProcessor the webp image in my link becomes upside down

aloksharma1 avatar Oct 08 '24 10:10 aloksharma1