RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.81k stars 405 forks source link

Can't change picture resolution #396

Open isabsent opened 4 years ago

isabsent commented 4 years ago

I have user your ActivityJava code example to change a picture resolution from highestResolution() to lowestResolution() without any effect:

private CameraConfiguration cameraConfiguration = CameraConfiguration
        .builder()
        .photoResolution(standardRatio(
//                highestResolution()
                lowestResolution()
//                new Function1<Iterable<Resolution>, Resolution>() {
//                    @Override
//                    public Resolution invoke(Iterable<Resolution> resolutions) {
//                        return new Resolution(320, 240);
//                    }
//                }
        ))
        .focusMode(firstAvailable(
                continuousFocusPicture(),
                autoFocus(),
                fixed()
        ))
        .flash(firstAvailable(
                autoRedEye(),
                autoFlash(),
                torch(),
                off()
        ))
        .previewFpsRange(highestFps())
        .sensorSensitivity(highestSensorSensitivity())
        .frameProcessor(new SampleFrameProcessor())
        .build();

new Resolution(320, 240) does change nothing too. My device is LG Stylus 3 (Android 7.0). What is a reason?

isabsent commented 4 years ago

At the same time your Kotlin variant MainActivity.kt works fine when I add pictureResolution = lowestResolution() to your initial configuration:

object Back : Camera(
        lensPosition = back(),
        configuration = CameraConfiguration(
                previewResolution = firstAvailable(
                        wideRatio(highestResolution()),
                        standardRatio(highestResolution())
                ),
                previewFpsRange = highestFps(),
                flashMode = off(),
                focusMode = firstAvailable(
                        continuousFocusPicture(),
                        autoFocus()
                ),
                frameProcessor = {
                    // Do something with the preview frame
                },
                pictureResolution = lowestResolution()
        )
)