custom_ratio_camera 0.0.4 copy "custom_ratio_camera: ^0.0.4" to clipboard
custom_ratio_camera: ^0.0.4 copied to clipboard

custom ratio for camera preview

This package allow you to have a custom ratio for camera preview using the camera package, you can the have a square camera preview as you need.

Features #

  • A CustomRatioCameraPreview widget
  • A callback function that will give you you all necessary informations to perform cropping

Getting started #

  • Install this package flutter pub add custom_ratio_camera
  • Follow the installation steps of the camera package

Usage #


  /// onCropData function to get cropping parameters
  ///
  ///[dx] and [dy] specify the top left corner of the output rectangle
  ///
  /// [w] is the width of the output rectangle
  ///
  /// [h] is the height of the output rectangle
  ///
  ///
  /// example: ``` ffmpeg -i in.mp4 -filter:v "crop=w:h:dx:dy" out.mp4 ```
  return CustomRatioCameraPreview(
       cameraController: cameraController,
       expectedRatio: 1/1,
       onCropData: (dx, dy, w, h) {
         print(dx);
         print(dy);
         print(h);
         print(w);
       },
     );


Additional information #

This package does not handle the cropping part, you will have to handle cropping using tools like ffmpeg

Credits #

Loic NGOU

3
likes
130
points
64
downloads

Publisher

verified publisherntech-services.com

Weekly Downloads

custom ratio for camera preview

Repository (GitHub)
View/report issues

Topics

#camera #custom-ratio

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

camera, flutter

More

Packages that depend on custom_ratio_camera