iOS Question (Solved) Flip horizontal ImageView - LLCamera

f0raster0

Well-Known Member
Licensed User
Longtime User
Hi Team

How can I flip the image so that it appears the same as when taking a picture with the front camera?
I'm using this example:

B4X:
Private Sub llc_PictureTaken (Data() As Byte)
    If Data.Length = 0 Then Return
    Dim In As InputStream
    In.InitializeFromBytesArray(Data, 0, Data.Length)
    Dim bmp As Bitmap
    bmp.Initialize2(In)
    In.Close
    ImageView1.Bitmap = bmp
    Log("Image size: " & bmp.Width & "x" & bmp.Height)
End Sub

Thank you in advance
 
Solution
Using BitmapCreatorEfects link library here
it flip and matches phone camera preview 👊, but the image is now rotated vertically 😭

B4X:
Private Sub llc_PictureTaken(Data() As Byte) ' OK flip matches phone camera preview, but the image is now rotated vertically
    If Data.Length = 0 Then Return

    Dim In As InputStream
    In.InitializeFromBytesArray(Data, 0, Data.Length)
    Dim bmp As Bitmap
    bmp.Initialize2(In)
    In.Close

    Log("Image size: " & bmp.Width & "x" & bmp.Height)
    
    If bmCEf.IsInitialized = False Then
        bmCEf.Initialize
    End If

    Dim flippedBmp As B4XBitmap = bmCEf.FlipHorizontal(bmp)
    If flippedBmp.IsInitialized Then
        ImageView1.Bitmap = flippedBmp
        Log("Flipped image set...

hatzisn

Expert
Licensed User
Longtime User
How about BitmapCreatorEffects?
 
Last edited:
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
Using BitmapCreatorEfects link library here
it flip and matches phone camera preview 👊, but the image is now rotated vertically 😭

B4X:
Private Sub llc_PictureTaken(Data() As Byte) ' OK flip matches phone camera preview, but the image is now rotated vertically
    If Data.Length = 0 Then Return

    Dim In As InputStream
    In.InitializeFromBytesArray(Data, 0, Data.Length)
    Dim bmp As Bitmap
    bmp.Initialize2(In)
    In.Close

    Log("Image size: " & bmp.Width & "x" & bmp.Height)
    
    If bmCEf.IsInitialized = False Then
        bmCEf.Initialize
    End If

    Dim flippedBmp As B4XBitmap = bmCEf.FlipHorizontal(bmp)
    If flippedBmp.IsInitialized Then
        ImageView1.Bitmap = flippedBmp
        Log("Flipped image set successfully.")
    Else
        Log("Failed to flip image.")
    End If
End Sub
 
Upvote 2
Solution

hatzisn

Expert
Licensed User
Longtime User
Using BitmapCreatorEfects link library here
it flip and matches phone camera preview 👊, but the image is now rotated vertically 😭

B4X:
Private Sub llc_PictureTaken(Data() As Byte) ' OK flip matches phone camera preview, but the image is now rotated vertically
    If Data.Length = 0 Then Return

    Dim In As InputStream
    In.InitializeFromBytesArray(Data, 0, Data.Length)
    Dim bmp As Bitmap
    bmp.Initialize2(In)
    In.Close

    Log("Image size: " & bmp.Width & "x" & bmp.Height)
   
    If bmCEf.IsInitialized = False Then
        bmCEf.Initialize
    End If

    Dim flippedBmp As B4XBitmap = bmCEf.FlipHorizontal(bmp)
    If flippedBmp.IsInitialized Then
        ImageView1.Bitmap = flippedBmp
        Log("Flipped image set successfully.")
    Else
        Log("Failed to flip image.")
    End If
End Sub

Sorry I pressed the upvote button accidentally in the phone. I cannot understand what might be wrong... Maybe @Erel would be the most suitable to answer this.
 
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
Sorry I pressed the upvote button accidentally in the phone. I cannot understand what might be wrong... Maybe @Erel would be the most suitable to answer this.
thanks, yes your iddea about the library BitMapCreatorEffects helped me to solve the issue about flipping the camera..then solved that question.
Topic solved.
 
Upvote 0
Top