Dim TargetWidth,TargetHeight As Int
Dim Exif As ExifData
Dim Orientation As String
Exif.Initialize(File.DirInternal, "Chess.jpg")
Orientation = Exif.getAttribute("Orientation")
Log("Exif Orientation: "&Orientation)
If Orientation = "0" Then
srcBitmap.InitializeResize(File.DirInternal,"Chess.jpg",TargetWidth,TargetHeight,False) 'load and adjusts the Bitmap to the format of the camera
End If
' the Sony Xperia cam leaves a picture that is 90 degrees rotated when the bitmap is loaded and displayed
'requires the BitMapExtended Library
If Orientation = "6" Then
Dim bmp As Bitmap
Dim bmp2 As Bitmap
bmp.InitializeMutable(TargetWidth,TargetWidth) 'must be a square to rotate it by 90 or 270 degrees!
bmp.Initialize(File.DirInternal, "Chess.jpg")
bmp = btmpex.rotateBitmap(bmp,90)
bmp2 = btmpex.createScaledBitmap(bmp,TargetWidth,TargetHeight,False) 'now get it back into the original size
srcBitmap = bmp2
End If
Log("File loaded")