Use case
The camera plugin currently provides no way to control the JPEG compression quality of captured still images. Developers who need smaller file sizes (e.g., for upload) must re-encode images in Dart after capture, which is slow and loses EXIF metadata.
Proposal
Add a setImageQuality(int quality) method to CameraController that accepts a value from 1 (maximum compression) to 100 (maximum quality). The setting applies to subsequent takePicture() calls.
Platform behavior
- Android (Camera2): Sets
CaptureRequest.JPEG_QUALITY on the capture request.
- Android (CameraX): Recreates
ImageCapture with the specified jpegQuality via ImageCapture.Builder.setJpegQuality().
- iOS (AVFoundation): Re-encodes the captured JPEG using
CGImageDestination with kCGImageDestinationLossyCompressionQuality, preserving all EXIF metadata.
Users who never call setImageQuality retain the platform's native default behavior.
Related: #30459
Use case
The camera plugin currently provides no way to control the JPEG compression quality of captured still images. Developers who need smaller file sizes (e.g., for upload) must re-encode images in Dart after capture, which is slow and loses EXIF metadata.
Proposal
Add a
setImageQuality(int quality)method toCameraControllerthat accepts a value from 1 (maximum compression) to 100 (maximum quality). The setting applies to subsequenttakePicture()calls.Platform behavior
CaptureRequest.JPEG_QUALITYon the capture request.ImageCapturewith the specifiedjpegQualityviaImageCapture.Builder.setJpegQuality().CGImageDestinationwithkCGImageDestinationLossyCompressionQuality, preserving all EXIF metadata.Users who never call
setImageQualityretain the platform's native default behavior.Related: #30459