Android Captured Image saved as Mirrored

63 Views Asked by At
val outputOptions = ImageCapture
        .OutputFileOptions
        .Builder(photoFile)
        .setMetadata(ImageCapture.Metadata().also {
            it.isReversedHorizontal = CameraSelector.LENS_FACING_FRONT == lensFacing
        }).build()

imageCapture.takePicture(
                    outputOptions, cameraExecutor, object : ImageCapture.OnImageSavedCallback {
                        override fun onError(exc: ImageCaptureException) {
                            Log.e(TAG, "Photo capture failed: ${exc.message}", exc)
                        }

                        override fun onImageSaved(output: ImageCapture.OutputFileResults) {
                            val savedUri = output.savedUri ?: Uri.fromFile(photoFile)
                            Log.d(TAG, "Photo capture succeeded: $savedUri")
                        }
                    })

While View image its Working fine , But while Save in local its not Working Fine, its in Mirror. Kindly help on this

1

There are 1 best solutions below

4
Xi 张熹 On

It's mirrored because you ask it to mirror it for the front camera. Simply remove this:

.setMetadata(ImageCapture.Metadata().also {
            it.isReversedHorizontal = CameraSelector.LENS_FACING_FRONT == lensFacing
        }