RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.81k stars 405 forks source link

Front camera : disabling mirror effect #375

Closed root-ansh closed 4 years ago

root-ansh commented 5 years ago

I used the following code to be able to open and save a front cam picture, but the resultant picture I receive is mirrored ( preview's left becomes saved picture's right and vice versa)

is there a way to recieve the image as it is, or is it a hardware problem?

root-ansh commented 5 years ago

Also, i didn't wanted to open a new request for this, but we can't toggle HDR , right?

AndyAls commented 4 years ago

Have you solved this problem?

root-ansh commented 4 years ago

@AndyAls, not yet, went on with other projects

AndyAls commented 4 years ago

thank you

Bridouille commented 4 years ago

Hi, I ran into the same issue. For now, this is how I fixed it, applying a matrix transformation to the Bitmap:

fun Bitmap.flipAndRotate(degrees: Float): Bitmap {
    val matrix = Matrix().apply {
        preScale(1f, -1f)
        postRotate(degrees)
    }
    return Bitmap.createBitmap(this, 0, 0, width, height, matrix, true)
}

The preScale(1f, -1f) did the trick.