You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposal:[camera] Add API to control JPEG compression quality #183229
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.
/// Sets the JPEG compression quality for subsequent [takePicture] calls.////// The [quality] parameter must be between 1 (maximum compression) and/// 100 (maximum quality).Future<void> setImageQuality(int quality)
Added to CameraPlatform (platform interface) and exposed via CameraController with 1–100 range validation.
Platform implementations
Android (Camera2) — New JpegQualityFeature that sets CaptureRequest.JPEG_QUALITY on the capture request builder. Lazily registered so users who never call setImageQuality keep the device HAL's native default.
Android (CameraX) — CameraX only supports setJpegQuality at ImageCapture construction time, so setImageQuality unbinds the current ImageCapture and recreates it with the requested quality. Locked capture orientation is preserved across the recreation.
iOS (AVFoundation) — When quality < 100 and format is JPEG, re-encodes the captured photo using CGImageDestination with kCGImageDestinationLossyCompressionQuality, preserving all EXIF metadata from the original capture. HEIF captures are passed through unmodified since CGImageDestination compression quality only applies to JPEG.
Design decisions
No default override: Users who never call setImageQuality retain the platform's native default behavior (device HAL default on Camera2, typically 95 on CameraX, system default on iOS).
Post-creation setting: Modeled as a setter rather than a constructor parameter to match the pattern of other camera settings (setFlashMode, setExposureMode, etc.).
JPEG-only on iOS: The quality parameter maps directly to JPEG compression. HEIF uses a different encoding pipeline and is passed through unchanged.
changed the title [-][camera] Add API to control JPEG compression quality[/-][+]Proposal:[camera] Add API to control JPEG compression quality[/+]on Mar 6, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
Bolling88 commentedon Mar 4, 2026
Design:
setImageQualityimplementationPR: flutter/packages#11155
API
Added to
CameraPlatform(platform interface) and exposed viaCameraControllerwith 1–100 range validation.Platform implementations
Android (Camera2) — New
JpegQualityFeaturethat setsCaptureRequest.JPEG_QUALITYon the capture request builder. Lazily registered so users who never callsetImageQualitykeep the device HAL's native default.Android (CameraX) — CameraX only supports
setJpegQualityatImageCaptureconstruction time, sosetImageQualityunbinds the currentImageCaptureand recreates it with the requested quality. Locked capture orientation is preserved across the recreation.iOS (AVFoundation) — When quality < 100 and format is JPEG, re-encodes the captured photo using
CGImageDestinationwithkCGImageDestinationLossyCompressionQuality, preserving all EXIF metadata from the original capture. HEIF captures are passed through unmodified sinceCGImageDestinationcompression quality only applies to JPEG.Design decisions
setImageQualityretain the platform's native default behavior (device HAL default on Camera2, typically 95 on CameraX, system default on iOS).setFlashMode,setExposureMode, etc.).[-][camera] Add API to control JPEG compression quality[/-][+]Proposal:[camera] Add API to control JPEG compression quality[/+][camera_platform_interface] Add setJpegImageQuality method (#11454)
github-actions commentedon Apr 28, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.[camera_platform_interface] Add setJpegImageQuality method (flutter#1…
[camera_platform_interface] Add setJpegImageQuality method (flutter#1…
[camera] Add setJpegImageQuality for JPEG compression control
[camera] Add setJpegImageQuality for JPEG compression control
[camera] Add setJpegImageQuality for JPEG compression control
[camera] Add setJpegImageQuality for JPEG compression control
[camera] Add setImageQuality for JPEG compression control (#11155)
[camera] Add setImageQuality for JPEG compression control (flutter#11155
[camera] Add setImageQuality for JPEG compression control (flutter#11155