Drping
Drping

Reputation: 53

Can i capture only top of image with cameraX?

I want to capture the top of an image with cameraX I know we can apply a ratio on image but when I do that the ratio is applied on the center of the image

I look on different method in ImageCaptureConfig.Builder but i found nothing relevant

val imageCaptureConfig = ImageCaptureConfig.Builder()
    .apply {
        setTargetAspectRatio(Rational(3, 1)) // I want this but on the top of the image
        setCaptureMode(ImageCapture.CaptureMode.MIN_LATENCY)
    }.build()

Upvotes: 0

Views: 1786

Answers (1)

Mike A
Mike A

Reputation: 717

You will need to do this code in the ImageCapture use case. See the official Android Camera X sample project for how they do cropping: https://github.com/android/camera/blob/master/CameraXBasic/app/src/main/java/com/android/example/cameraxbasic/fragments/CameraFragment.kt#L205

Upvotes: 1

Related Questions