Free Support Forum -

Image.Width and Image.Height properties are swapped

Running this code on the attached image using Aspose.Imaging for .NET 20.5 : input.jpg (2.4 MB)

var img = Aspose.Imaging.Image.Load("input.jpg");
Console.WriteLine("Width: " + img.
Console.WriteLine("Height: " + img.Height);

gives the following output:

Width: 3648
Height: 2736

However, when viewing the image in a graphics viewer (such as Irfanview) or browser, its dimensions are swapped: Width = 2736, Height = 3648.

Can you please advise how to get the correct dimensions. If the image is auto-rotating, is there a flag to show the orientation?



I have tested using Aspose.Imaging for .NET 20.5 and there is no issue my end while accessing the image width and height. Please observe the attached snapshot image for properties and console output.

image.png (26.7 KB)

Hi Mudassir,

Please see my screenshot showing the Width and Height properties are swapped. I get the same result on another computer.

ss1.png (9.9 KB)

We are running the same code but getting different result, so there must be some other factor. Do you have any ideas why the Width & Height properties are returning different values on my computers than on yours?



Can you please possibly provide the working sample Visual Studio project you are using along with information about Windows version and Screen resolution settings you have. I may use this information to contact our team for possible reason.

Hi Mudassir

Please find attached the Visual Studio console app I am using: (2.9 MB) (excluding the Aspose.Imaging v20.5 Nuget package)

When I run it, it produces the following:

Width: 3648
Height: 2736

The environment is:

  • Microsoft Windows 10 Home Version 10.0.18363 Build 18363
  • x64-based PC
  • Intel Core i5-5200U CPU @ 2.20GHz, 2195 Mhz
  • IntelĀ® HD Graphics 5500
  • 1920 x 1080 x 60 hertz
  • Bits/Pixel 32
  • .Net Framework 4.8



I have worked with new image and it has reproduced the issue on my end. A ticket with ID IMAGINGNET-3957 has been created to investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.