1

I am getting incorrect image dimension using the Syste.Drawing.Image

Code -

using(var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
using (Image image = Image.FromStream(fileStream,false,false))
{
    var width = image.Width;
    var height = image.Height;
}

This is my image Image

The properties shows 2432x3648 but in code i am getting 3648x2432.

  • Are you not mixing up width and height? the larger number should presumably be the height, but you are getting width = 3648? – JonasH Dec 08 '21 at 12:10
  • When getting the width through code, its giving 3648 but when I check it in properties the width is 2432. Am not sure what's going wrong. – Devdrone Bhowmik Dec 08 '21 at 12:33
  • 3
    Most liokely there is a [rotation tag](https://stackoverflow.com/questions/42971094/getting-correct-image-rotation/42972969?r=SearchResults&s=1|33.8811#42972969) set in the image. - Some apps honor it some don't.. – TaW Dec 08 '21 at 12:50

0 Answers0