kls dngr

kls dngr

  • NA
  • 17
  • 2.2k

How to set orientation property of an image before save?

Sep 8 2015 5:03 AM
foreach (var prop in img.PropertyItems)
{
      if (prop.Id == 0x0112) //value of EXIF
      {
         var orientation = img.GetPropertyItem(prop.Id).Value[0];
         switch (orientation)
         {
            case 1:
            // No rotation required.
            break;
            case 2:
            img.RotateFlip(RotateFlipType.RotateNoneFlipX);
            break;
            case 3:
            img.RotateFlip(RotateFlipType.Rotate180FlipNone);
 
 
I have used above code to detect whether image orietation is changed from original. Suppose I have get orientation value as "3" and I want to set it to normal that is "1", so how I could replace that orientation property value 3 by 1...?? 

Answers (1)