Dim MetadataReader As JavaObject
Dim ExifReader As JavaObject
ExifReader.InitializeNewInstance("com.drew.metadata.exif.ExifReader", Null)
Dim readers As List = Array(ExifReader)
Try
Dim Metadata As JavaObject = MetadataReader.InitializeStatic("com.drew.imaging.jpeg.JpegMetadataReader").RunMethod("readMetadata", Array(In, readers))
For Each dic As JavaObject In Metadata.RunMethod("getDirectories", Null).As(List)
Dim orientation As Object = dic.RunMethod("getInteger", Array(274)) 'orientation
If orientation <> Null Then
Media.Media = RotateBitmapBasedOnOrientation(Media.Media, orientation)
Exit
End If
Next
Catch
Log(LastException)
End Try