Hi All,
I saw en example how image orientation was accessed in SMM.
#if B4A
If B4ASdkVersion >= 24 Then
Dim ExifInterface As JavaObject
ExifInterface.InitializeNewInstance("android.media.ExifInterface", Array(In))
Dim orientation As Int = ExifInterface.RunMethod("getAttribute", Array("Orientation"))
Media.Media = RotateBitmapBasedOnOrientation(Media.Media, orientation)
End If
In.Close
#Else If B4J AND SMM_META
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
In.Close
#End If
How would I go about obtaining the LatLon values in a separate routine within my own code.
I have tried jpegutils but I can not get it to work. SMM seems to offer a simpler method.
I am most interested in B4A
Gunnar
I saw en example how image orientation was accessed in SMM.
#if B4A
If B4ASdkVersion >= 24 Then
Dim ExifInterface As JavaObject
ExifInterface.InitializeNewInstance("android.media.ExifInterface", Array(In))
Dim orientation As Int = ExifInterface.RunMethod("getAttribute", Array("Orientation"))
Media.Media = RotateBitmapBasedOnOrientation(Media.Media, orientation)
End If
In.Close
#Else If B4J AND SMM_META
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
In.Close
#End If
How would I go about obtaining the LatLon values in a separate routine within my own code.
I have tried jpegutils but I can not get it to work. SMM seems to offer a simpler method.
I am most interested in B4A
Gunnar