Skip to content

Proposal:[camera] Add API to control JPEG compression quality #183229

Description

@Bolling88

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterp: cameraThe camera pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyplatform-iosiOS applications specificallyteam-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions