Android Question Need help with camera

Alexander Stolte

Expert
Licensed User
Longtime User
Hello Community,

I use this Library from Erel: cameraex

In the preview view, I see the live camerapicture.

When I press the shutter button, it saves the image. Where can I set the resolution? Because after I let it display to me it looks turned.

picture001-min.PNG picture002-min.PNG picture003-min.PNG

Or it is possible to save the image as in the Preview?
 

DonManfred

Expert
Licensed User
Longtime User
Where can I set the resolution?
You need to change Parameters to set the Resolution.
See GetSupportedPicturesSizes to get a List of Supported sizes. And use SetPictureSize to set it to one of this sizes...
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Thanks, the log says:
B4X:
[Height=1080, IsInitialized=false, Width=1920

and the picture say: 4032x3024

why?

"SetPictureSize" and "SetPreviewSize" have the same code.

EDIT: same result after change the parameter

B4X:
Public Sub SetPictureSize(Width As Int, Height As Int)
    r.target = parameters
    r.RunMethod3("setPictureSize", 1920, "java.lang.int", 1080, "java.lang.int")
    'r.RunMethod3("setPictureSize", Width, "java.lang.int", Height, "java.lang.int")
End Sub

mhh
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Many thanks, it works!

B4X:
Sub LoadbitmapSample2(Dir As String,Filename As String,MaxWidth As Int,MaxHeight As Int,AutoRotate As Boolean) As Bitmap
    Dim bm As Bitmap
    bm=LoadBitmapSample(Dir,Filename,100%x,100%y)
    If AutoRotate Then
        Dim bm2 As BitmapExtended
        Dim exifdata1 As ExifData
        Try
            exifdata1.Initialize(Dir,Filename)
            'http://sylvana.net/jpegcrop/exif_orientation.html
            ' 1) transform="";;
            ' 2) transform="-flip horizontal";;
            ' 3) transform="-rotate 180";;
            ' 4) transform="-flip vertical";;
            ' 5) transform="-transpose";;
            ' 6) transform="-rotate 90";;
            ' 7) transform="-transverse";;
            ' 8) transform="-rotate 270";;
            Select Case exifdata1.getAttribute(exifdata1.TAG_ORIENTATION)
                Case exifdata1.ORIENTATION_ROTATE_180 '3
                    bm=bm2.rotateBitmap(bm,180)
                Case exifdata1.ORIENTATION_ROTATE_90 '6
                    bm=bm2.rotateBitmap(bm,90)
                Case exifdata1.ORIENTATION_ROTATE_270 '8
                    bm=bm2.rotateBitmap(bm,270)
            End Select
        Catch
        End Try
    End If
    Return bm
End Sub


Sub img_newcat_Click
    img_previewbig.Bitmap    = LoadbitmapSample2(File.DirRootExternal, "momentcatpicture.jpg", 1920, 1080, True)
    img_previewbig.SetVisibleAnimated(2000, True)
End Sub
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Many thanks, it works!

I have a little problem with this code. What is when my data comes from the reqManager like that:

B4X:
Dim picture2 As Bitmap = reqManager.BytesToImage(picture)
     ImageView1.Bitmap = LoadbitmapSample2("", "",1920, 1080, True)

and i dont have the "dir" name and "Filename"? what is the workaround for this?
 
Upvote 0
Top