Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The width and height of my image are reversed #2644

Closed
4 tasks done
Zhao-Michael opened this issue Jan 14, 2024 · 4 comments
Closed
4 tasks done

The width and height of my image are reversed #2644

Zhao-Michael opened this issue Jan 14, 2024 · 4 comments

Comments

@Zhao-Michael
Copy link

Zhao-Michael commented Jan 14, 2024

Prerequisites

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

ImageSharp version

3.1.2

Other ImageSharp packages and versions

N/A

Environment (Operating system, version and so on)

Win10 22H2

.NET Framework version

.Net8.0

Description

The width and height of my image are reversed, the width should be 1080, and Height should be 1440.

image

Steps to Reproduce

Just load the attached image in 'IMG1.zip', And Check the Width and Height of the image:

using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Metadata.Profiles.Exif;
using SixLabors.ImageSharp.Processing;

var path = @"IMG1.jpg";
using var image = Image.Load(path);
Console.WriteLine(image.Width.ToString() + " x " + image.Height.ToString());

Images

IMG1.zip

@JimBobSquarePants
Copy link
Member

The width and height will be accurate. The EXIF metadata will indicate that the image is rotated.

@Zhao-Michael
Copy link
Author

So ImageSharp will not help to reverse width and height?
Since I see most of image viewer software like PS, window10 photos can handle it well...

@tocsoft
Copy link
Member

tocsoft commented Jan 14, 2024

if you run the img.Mutate(x=>x.AutoOrient()) it'll fix up the pixel data to be orientated as expected.

Note this is a difference stemming from audience expectations between image viewing and programmatic image manipulation. Image viewers are processing the data for humans to understand and physically look at where as ImageSharp is for manipulating the individual pixel data. Rotating the pixel data in memory (rather that adding a tag to tell a viewer to do it for you, which is the case here) would increase memory usage and loading time in places where not everyone will want/need that behaviour.

@tiesont
Copy link

tiesont commented Jan 15, 2024

For what it's worth, this has been discussed before. @JimBobSquarePants has an example of a quick program you can write to verify what they're saying, in #1613

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants