Apparence-io / CamerAwesome

📸 Embedding a camera experience within your own app shouldn't be that hard. A flutter plugin to integrate awesome Android / iOS camera experience.
https://ApparenceKit.dev
MIT License
947 stars 234 forks source link

Output picture with specified dimensions #215

Closed iNakel closed 1 year ago

iNakel commented 1 year ago

Hello! I know there have been some changes made to the whole package. I was wondering... (since I haven't found it), ¿how do I set the resolution of the pictures taken to be a specific size (for example, dimensions: 1920x1080)?

¿Is that feature still possible with all changes?

Thanks, and keep up the great work!

apalala-dev commented 1 year ago

Unfortunately, it is not possible to set a specific resolution since the rework. :(

At the moment, your best bet could be to set a target aspect ratio like below:

CameraAwesomeBuilder.awesome(
  saveConfig: SaveConfig.photoAndVideo(
    photoPathBuilder: () => _path(CaptureMode.photo),
    videoPathBuilder: () => _path(CaptureMode.video),
    initialCaptureMode: CaptureMode.photo,
  ),
  aspectRatio: CameraAspectRatios.ratio_16_9,
  onMediaTap: (mediaCapture) {
    // Do something
  },
)

If you really want to reduce the picture dimensions, you will have to resize it afterwards (if it already has the good aspect ratio, it should not be too difficult). The package image could help you with that.

We migrated to CameraX on the Android side and it comes with its pros and cons. For the resolution, it lets specify any picture resolution but doesn't guarantee it will be used (it chooses something close). We don't think it's very intuitive so we might take an other approach, like a target "image quality" associated with an aspect ratio.