diff --git a/app/src/main/java/com/simplemobiletools/camera/Preview.java b/app/src/main/java/com/simplemobiletools/camera/Preview.java index 0ad7cb9a..f46be232 100644 --- a/app/src/main/java/com/simplemobiletools/camera/Preview.java +++ b/app/src/main/java/com/simplemobiletools/camera/Preview.java @@ -165,8 +165,8 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O parameters.setFlashMode(Camera.Parameters.FLASH_MODE_OFF); } - final Camera.Size maxPictureSize = parameters.getSupportedPictureSizes().get(0); - parameters.setPictureSize(maxPictureSize.width, maxPictureSize.height); + final Camera.Size maxSize = getPictureSize(); + parameters.setPictureSize(maxSize.width, maxSize.height); MediaPlayer.create(getContext(), R.raw.camera_shutter).start(); camera.setParameters(parameters); @@ -199,6 +199,19 @@ public class Preview extends ViewGroup implements SurfaceHolder.Callback, View.O } }; + // limit the max picture size at 8 megapixels + private Camera.Size getPictureSize() { + List sizes = parameters.getSupportedPictureSizes(); + Camera.Size maxSize = sizes.get(0); + for (Camera.Size size : sizes) { + if (size.width * size.height < 9000000) { + maxSize = size; + break; + } + } + return maxSize; + } + private void focusArea() { if (camera == null) return;