Hi,
By using existing public API, apps can't specify a setting to select equal to or lower resolution against a specific size. But we're working on a new ResolutionSelector API to provide such a kind of ability. The new ResolutionSelector API is targeted to be public in the 1.3.0-alpha stage.
A short-term solution, you might be able to retrieve the supported JPEG output sizes via Camera2Interop. The code might be similar to:
val cameraInfo = ... // retrieves the CameraInfo of the target camera
val camera2CameraInfo = Camera2CameraInfo.from(cameraInfo)
val streamConfigurationMap = camera2CameraInfo.getCameraCharacteristics(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP)
val jpegOutputSizes = streamConfigurationMap.getOutputSizes(ImageFormat.JPEG)
// Try to find your preferred size from jpegOutputSizes and then specify it as the ImageCapture's target resolution (Please remember to flip the size according to your target rotation setting)
// Then, bind the ImageCapture use case to lifecycle
BTW, you should be able to unbind the bound ImageCapture use case by
ProcessCameraProvider#unbind(UseCase[]). Could you describe more details about the problem you encountered when rebinding the ImageCapture use case?