title: Get Image Orientation and rotate as per orientation
body: <p>having problem in getting image orientation with below code</p>
  
  <pre><code>    string fileName = @"D:\...\...\01012015004435.jpeg";
  
      int rotate = 0;
      using (var image = System.Drawing.Image.FromFile(fileName))
      {
          foreach (var prop in image.PropertyItems)
          {
              if (prop.Id == 0x112)
              {
                  if (prop.Value[0] == 6)
                      rotate = 90;
                  if (prop.Value[0] == 8)
                      rotate = -90;
                  if (prop.Value[0] == 3)
                      rotate = 180;
                  prop.Value[0] = 1;
              }
          }
      }
  </code></pre>
  
  <p>and after get proper orientation i used to rotate image like</p>
  
  <pre><code>private static RotateFlipType OrientationToFlipType(string orientation)
  {
      switch (int.Parse(orientation))
      {
          case 1:
              return RotateFlipType.RotateNoneFlipNone;
              break;
          case 2:
              return RotateFlipType.RotateNoneFlipX;
              break;
          case 3:
              return RotateFlipType.Rotate180FlipNone;
              break;
          case 4:
              return RotateFlipType.Rotate180FlipX;
              break;
          case 5:
              return RotateFlipType.Rotate90FlipX;
              break;
          case 6:
              return RotateFlipType.Rotate90FlipNone;
              break;
          case 7:
              return RotateFlipType.Rotate270FlipX;
              break;
          case 8:
              return RotateFlipType.Rotate270FlipNone;
              break;
          default:
              return RotateFlipType.RotateNoneFlipNone;
      }
  }
  </code></pre>
  
  <p>but problem is in first code</p>
  
  <p><code>prop.Id</code> i always get [20625]</p>
  
  <pre><code>prop.Id == 20625
  </code></pre>
  
  <p>so not satisfy the condition every time 
  please let me know if any problem or other option</p>
  
  <p>thanks </p>