---
title: Selecting camera input
slug: selecting-camera-input
createdAt: 2021-10-12T15:30:04.000Z
---

Camera input selection isn't directly available via the API yet, however, in order to dynamically isolate your camera input into a bitmap, you can use the following function where `previewWidth` and `previewHeight`depend on your current resolution, this means you must keep track of resolution changes:

```kotlin
    //CameraResolution.SD
    val previewWidth = 1280
    val previewHeight = 480

    //CameraResolution.MD
//    val previewWidth = 2560
//    val previewHeight = 720

    //CameraResolution.HD
//    val previewWidth = 3840
//    val previewHeight = 1080

    fun byteArrayToCroppedBitmap(byteArray: ByteArray?): Bitmap? {

        val yuvImage = YuvImage(byteArray, ImageFormat.NV21, previewWidth, previewHeight, null)
        val os = ByteArrayOutputStream()
        yuvImage.compressToJpeg(Rect(0, 0, previewWidth, previewHeight), 100, os)
        val jpegByteArray = os.toByteArray()
        val bmp = BitmapFactory.decodeByteArray(jpegByteArray, 0, jpegByteArray.size)

        return Bitmap.createBitmap(bmp, 0, 0, previewWidth / 2, previewHeight)
    }


    
```

