Socket
Book a DemoInstallSign in
Socket

vision-camera-cropper-sked

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vision-camera-cropper-sked

A react native vision camera frame processor for cropping

latest
Source
npmnpm
Version
1.3.5
Version published
Weekly downloads
7
Maintainers
1
Weekly downloads
 
Created
Source

vision-camera-cropper

A react native vision camera frame processor for cropping

Demo video

Versions

For Vision Camera v3, use versions 0.x.

For Vision Camera v4, use versions >= 1.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-core/plugin']],
    // ...

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

Usage

  • Crop a frame and return its base64 or path.

    import { crop } from 'vision-camera-cropper';
    
    // ...
    const frameProcessor = useFrameProcessor((frame) => {
      'worklet';
      //coordinates in percentage
      const cropRegion = {
        left:10,
        top:10,
        width:80,
        height:30
      }
      const result = crop(frame,{cropRegion:cropRegion,includeImageBase64:true,saveAsFile:false});
      console.log(result.base64);
    }, []);
    
  • Rotate an image.

    const rotated = await rotateImage(base64,degree);
    

Get Bitmap/UIImage via Reflection

If you are developing a plugin to get the camera frames, you can use reflection to get it as Bitmap or UIImage on the native side.

Java:

Class cls = Class.forName("com.visioncameracropper.CropperFrameProcessorPlugin");
Method m = cls.getMethod("getBitmap",null);
Bitmap bitmap = (Bitmap) m.invoke(null, null);

Objective-C:

- (UIImage*)getUIImage{
    UIImage *image = ((UIImage* (*)(id, SEL))objc_msgSend)(objc_getClass("CropperFrameProcessorPlugin"), sel_registerName("getBitmap"));
    return image;
}

You have to pass {saveBitmap: true} for the crop function.

Blog

How to Create a React Native Vision Camera Plugin to Crop Frames

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

Keywords

react-native

FAQs

Package last updated on 24 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts