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

outdated

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, h, w) {
         print(dx);
         print(dy);
         print(h);
         print(w);
       },
     );
[./imgs/1_1.jpg]
[./imgs/9_16.jpg]
[./imgs/16_9.jpg]

Additional information #

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

Credits #

3
likes
0
points
88
downloads

Publisher

verified publisherntech-services.com

Weekly Downloads

custom ratio for camera preview

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

camera, flutter

More

Packages that depend on custom_ratio_camera