Reputation: 6335
I have an app that let's you take pictures and upload them to our server. The problem is sometimes the pictures are upside down, sometimes are rotated left or right. How can i correct this? How can I rotate the image so that it looks ok on the computer after uploaded? Thanks.
Upvotes: 2
Views: 891
Reputation: 6335
Here is how i rotated on the server:
Dim rft As RotateFlipType = RotateFlipType.RotateNoneFlipNone
Dim properties As PropertyItem() = img.PropertyItems
For Each prop As PropertyItem In properties
'274 is the exif id for camera orientation
If prop.Id = 274 Then
Dim orientation As Short = BitConverter.ToInt16(prop.Value, 0)
Select Case orientation
Case 1
rft = RotateFlipType.RotateNoneFlipNone
Exit Select
Case 3
rft = RotateFlipType.Rotate180FlipNone
Exit Select
Case 6
rft = RotateFlipType.Rotate90FlipNone
Exit Select
Case 8
rft = RotateFlipType.Rotate270FlipNone
Exit Select
End Select
Exit For
End If
Next
If rft <> RotateFlipType.RotateNoneFlipNone Then
img.RotateFlip(rft)
End If
Return rft
Upvotes: -1
Reputation: 15061
You have many solutions:
Upvotes: 2