infinum / Android-GoldenEye

A wrapper for Camera1 and Camera2 API which exposes simple to use interface.
Apache License 2.0
375 stars 53 forks source link

Can I get the Uri of photo after the image is captured by GoldenEye #35

Closed Pratishruti closed 4 years ago

Pratishruti commented 4 years ago

Hi, Can I get the Uri of image as I am getting bitmap from " onPictureTaken" callback.

goldenEye.takePicture( onPictureTaken = { bitmap ->

                    if (bitmap.width <= 4096 && bitmap.height <= 4096) {
                        displayPicture(bitmap)
                    } else {
                        reducePictureSize(bitmap)
                    }
                },
                onError = { it.printStackTrace() }
        )

Please help me out. Thanks

domagojkorman commented 4 years ago

Hi @Pratishruti ,

you can't get URI because the image you receive is kept in memory, not stored anywhere in the file system. GoldenEye simply converts bytes array into a Bitmap and it is up to developer to store the image wherever he wants.

Pratishruti commented 4 years ago

Ok. Thanks a lot.

Actually I wanted to know the angle of image so that I can rotate it when captured in landscape mode. But, I guess its not possible if I get the bitmap instead of Uri. In my case I am keeping auto rotation off in device as in some devices (i.e. moto x4) when I change the orientation of device while recording video the camera view gets distorted. After this the distortion issue is resolved but if I capture an image in landscape mode then the image is showing as it it I mean in landscape mode. I wanted to rotate it to portrait while showing.

Thanks.

domagojkorman commented 4 years ago

The image is always rotated to the same orientation that the picture was taken in. You can rotate the Bitmap however you want using Bitmap transformation after you receive the image.