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
949 stars 240 forks source link

Add option to set `aspectRatio` and `photoSize` on init #174

Closed Zazo032 closed 1 year ago

Zazo032 commented 1 year ago

Proposal

At least for now, there's no clear doc or way to set a specific initial aspect ratio and photo size

Zazo032 commented 1 year ago

@apalala-dev @g-apparence calling await CamerawesomePlugin.setPhotoSize(1080, 1920) seems to do nothing, is there any way to change the final photo size with the new implementation? Final images are 4000x2250, which is too big for our use case. Tried a couple different approaches, but I couldn't find a working one

g-apparence commented 1 year ago

Hi, we made this on purpose.

The new version doesn't include selecting the photo size because of

For now our approach is

Would this fit your need?

apalala-dev commented 1 year ago

@Zazo032 I just published a PR with the initial aspectRatio and with support for aspect ratio 1:1 on Android.

As @g-apparence mentioned, we don't specify photo size yet because CameraX might find a photo size with a different aspectRatio.

Would changing the jpeg quality of the output suit your need ? It might reduce the size of the file (but not its resolution).

Zazo032 commented 1 year ago

@g-apparence Hi, makes sense the approach you followed. We implemented an extra step in our flow to compress images to our desired size. To set the aspect ratio, we're currently doing this:

CameraAwesomeBuilder.custom(
  builder: (state) {
    if (sensorConfig.aspectRatio != CameraAspectRatios.ratio_16_9) {
      sensorConfig.setAspectRatio(CameraAspectRatios.ratio_16_9);
      return ...
    }
  }
),

Might not be the best approach, but I think it's the only way to do it automatically right now.

Zazo032 commented 1 year ago

Fixed by #180