Android Question Get Minimum Supported Picture Size using CamEx

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use this code to set the minimum supported size:
B4X:
Private Sub SetMinimumSize
   Dim minCS As CameraSize
   For Each cs As CameraSize In camEx.GetSupportedPicturesSizes
     If minCS.Width = 0 Then
       minCS = cs
     Else
       If Power(minCS.Width, 2) + Power(minCS.Height, 2) > Power(cs.Width, 2) + Power(cs.Height, 2) Then
         minCS = cs
       End If
     End If
   Next
   camEx.SetPictureSize(minCS.Width, minCS.Height)
   Log("Selected size: " & minCS)
End Sub

Call it from Camera_Ready before the call to CommitParameters.
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
You can use this code to set the minimum supported size:
B4X:
Private Sub SetMinimumSize
   Dim minCS As CameraSize
   For Each cs As CameraSize In camEx.GetSupportedPicturesSizes
     If minCS.Width = 0 Then
       minCS = cs
     Else
       If Power(minCS.Width, 2) + Power(minCS.Height, 2) > Power(cs.Width, 2) + Power(cs.Height, 2) Then
         minCS = cs
       End If
     End If
   Next
   camEx.SetPictureSize(minCS.Width, minCS.Height)
   Log("Selected size: " & minCS)
End Sub

Call it from Camera_Ready before the call to CommitParameters.
Thanks a lot Erel..
 
Upvote 0

Ydm

Active Member
Licensed User
Longtime User
I use for minimum size "camEx.GetSupportedPicturesSizes(0)"

For maximum size camEx.GetSupportedPicturesSizes(camEx.GetSupportedPicturesSizes.Length-1)
 
Upvote 0
Top