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

Image in portrait load size-s as landscape #1613

Closed
vorodot opened this issue Apr 19, 2021 · 2 comments
Closed

Image in portrait load size-s as landscape #1613

vorodot opened this issue Apr 19, 2021 · 2 comments
Labels

Comments

@vorodot
Copy link

vorodot commented Apr 19, 2021

Hi,

I have two images which thumbnails and real size images are shown properly in Windows Explorer and in image editors that I use.
Unfortunately when I load the size of the portrait image the SixLabors.ImageSharp library returns the dimensions as landscape. I cannot find a property that I can use to for orientation.

Steps to Reproduce

There is attached zip with demo.

System Configuration

.NET Core application with 1.0.3 version of SixLabors.ImageSharp.
Windows 10

Capture
netcoreapp3.1.zip

The code of the program:

using (var image = Image.Load("DSC_9396.JPG"))
{
  Console.WriteLine("Landscape: DSC_9396.JPG");
  Console.WriteLine("Width: " + image.Width);
  Console.WriteLine("Height: " + image.Height);
}
Console.WriteLine("");
using (var image = Image.Load("DSC_9398.JPG"))
{
  Console.WriteLine("Portrait: DSC_9398.JPG");
  Console.WriteLine("Width: " + image.Width);
  Console.WriteLine("Height: " + image.Height);
}

Console.ReadLine();
@JimBobSquarePants
Copy link
Member

JimBobSquarePants commented Apr 19, 2021

ImageSharp is doing the correct thing here.

The second portrait image is actually 6000 pixels wide but has an EXIF orientation property which rotates the image for display to portrait mode. Windows returns the EXIF dimensions in it's details info but that wouldn't be correct for pixel processing.

Here's System.Drawing returning the same results.

image

@antonfirsov
Copy link
Member

@vorodot AutoOrient will help you out:

image.Mutate(c => c.AutoOrient());

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

No branches or pull requests

3 participants