Take photo of certain size with Compose

221 Views Asked by At

I need to take photo using system camera application. My simplified code looks like this:

@Composable
fun takePhoto(){     
val cameraLauncher = rememberLauncherForActivityResult(
    contract = ActivityResultContracts.TakePicture(),
    onResult = { success ->  ... }
)
...
if (hasCamPermission) {
    val uri = ComposeFileProvider.getImageUri(context)
    imageUri = uri
    cameraLauncher.launch(uri)
}

But I want to compress resulted photo. Is there any way to request photo of certain size or I need to do it manually? What is the best way to do it?

0

There are 0 best solutions below