Skip to content

Latest commit

 

History

70 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vision-camera-cropper

A react native vision camera frame processor for cropping

react-native-vision-camera-cropper.mp4

Versions

For Vision Camera v3, use versions 0.x.

For Vision Camera v4, use versions >= 1.0.0 < 2.0.0

For Vision Camera v5, use versions >= 2.0.0

Installation

yarn add vision-camera-cropper
cd ios && pod install

Add the plugin to your babel.config.js:

module.exports = {
   plugins: [['react-native-worklets/plugin']],
  // ...

Note: You have to restart metro-bundler for changes in the babel.config.js file to take effect.

Usage

  1. Crop a frame and return its base64 or path.

    import { crop } from 'vision-camera-cropper';
    
    // ...
    const frameOutput = useFrameOutput({
      pixelFormat: 'yuv',
      onFrame: (frame) => {
        'worklet';
      
        const result = crop(frame, {
          cropRegion: cropRegionShared.value,
          includeImageBase64: true,
        });
    
        frame.dispose();
      },
    });
  2. Rotate an image.

    const rotated = await rotateImage(base64,degree);

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

About

A vision camera frame processor plugin for cropping

Resources

Code of conduct

Contributing

Stars

49 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages