Adam W
Adam W

Reputation: 285

Flutter - control camera resolution

Is there a way to "force" phone camera to take a picture with full HD resolution 1920x1080 instead of default 3420x4032 ?

Upvotes: 1

Views: 1683

Answers (1)

Peter Koltai
Peter Koltai

Reputation: 9744

If you use camera package, you can set the resolution using ResolutionPreset, see possible values here.

In your case define a CameraController after getting available cameras like this (assuming there is a camera available and you want to use the first one):

final cameras = await availableCameras();
final controller = CameraController(cameras[0], ResolutionPreset.veryHigh);
final preview = CameraPreview(controller);

This is a simple example, in a real world app you need to keep track of the controller and dispose it properly.

Upvotes: 2

Related Questions