All Projects → ggunti → React Native Amazing Cropper

ggunti / React Native Amazing Cropper

Licence: mit
Image cropper for react native using Animated API

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to React Native Amazing Cropper

Mesh mesh align plus
Precisely align, move, and measure+match objects and mesh parts in your 3D scenes.
Stars: ✭ 350 (+422.39%)
Mutual labels:  rotation
Android Image Cropper
Image Cropping Library for Android, optimized for Camera / Gallery.
Stars: ✭ 5,955 (+8788.06%)
Mutual labels:  cropper
React Cropper
react cropper
Stars: ✭ 13 (-80.6%)
Mutual labels:  cropper
Vue Avatar Cropper
👧 A simple and elegant avatar cropping and upload plugin.
Stars: ✭ 398 (+494.03%)
Mutual labels:  cropper
Zmjimageeditor
ZMJImageEditor is a picture editing component like WeChat. It is powerful and easy to integrate, supporting rendering, text, rotation, tailoring, mapping and other functions. (ZMJImageEditor 是一个和微信一样图片编辑的组件,功能强大,极易集成,支持绘制、文字、旋转、剪裁、贴图等功能)
Stars: ✭ 470 (+601.49%)
Mutual labels:  rotation
Image Cropper
💯一款功能强大的微信小程序图片裁剪插件
Stars: ✭ 893 (+1232.84%)
Mutual labels:  cropper
Dota Doai
This repo is the codebase for our team to participate in DOTA related competitions, including rotation and horizontal detection.
Stars: ✭ 326 (+386.57%)
Mutual labels:  rotation
Robond Kinematics Project
Robotic Arm Pick & Place using ROS, RViz, Gazebo, and KUKA KR210
Stars: ✭ 39 (-41.79%)
Mutual labels:  rotation
Jquery Cropper
A jQuery plugin wrapper for Cropper.js.
Stars: ✭ 516 (+670.15%)
Mutual labels:  cropper
Vue Croppa
A simple straightforward customizable mobile-friendly image cropper for Vue 2.0.
Stars: ✭ 942 (+1305.97%)
Mutual labels:  cropper
Tocropviewcontroller
A view controller for iOS that allows users to crop portions of UIImage objects
Stars: ✭ 4,210 (+6183.58%)
Mutual labels:  cropper
R3det tensorflow
Code for AAAI 2021 paper: R3Det: Refined Single-Stage Detector with Feature Refinement for Rotating Object
Stars: ✭ 434 (+547.76%)
Mutual labels:  rotation
Croppy
Image Cropping Library for Android
Stars: ✭ 906 (+1252.24%)
Mutual labels:  cropper
Handeye calib camodocal
Easy to use and accurate hand eye calibration which has been working reliably for years (2016-present) with kinect, kinectv2, rgbd cameras, optical trackers, and several robots including the ur5 and kuka iiwa.
Stars: ✭ 364 (+443.28%)
Mutual labels:  rotation
Cropper dropzone
Using croppper.js with dropzone.js lib
Stars: ✭ 13 (-80.6%)
Mutual labels:  cropper
Ik
Minimal Inverse Kinematics library
Stars: ✭ 340 (+407.46%)
Mutual labels:  rotation
Photo Editor
A simple photo editing application.
Stars: ✭ 753 (+1023.88%)
Mutual labels:  cropper
Cropper
⚠️ [Deprecated] No longer maintained, please use https://github.com/fengyuanchen/jquery-cropper
Stars: ✭ 7,825 (+11579.1%)
Mutual labels:  cropper
Rverify.js
✅❎ A lightweight image rotation verification plugin.
Stars: ✭ 33 (-50.75%)
Mutual labels:  rotation
Angular Cropper
Touch-enabled image cropper for AngularJS
Stars: ✭ 22 (-67.16%)
Mutual labels:  cropper

react-native-amazing-cropper

Image cropper for react native made with Animated API (with rotation possibility) - for iOS & android

It is written in typescript!

    
    


    
    

This component depend on react-native-image-rotate and @react-native-community/image-editor libraries. They need to be installed and linked to your project before.

STEPS TO INSTALL: 1.* npm install --save react-native-image-rotate @react-native-community/image-editor 2. react-native link react-native-image-rotate @react-native-community/image-editor 3.* npm install --save react-native-amazing-cropper

Step 2 is not needed for react-native >= 0.60 because of autolinking. Instead run pod install inside ios directory.

Properties


Prop Type Description
onDone function A function which accepts 1 argument croppedImageUri. Called when user press the 'DONE' button
onError function A function which accepts 1 argument err of type Error. Called when rotation or cropping fails
onCancel function A function without arguments. Called when user press the 'CANCEL' button
imageUri string The uri of the image you want to crop or rotate
imageWidth number The width (in pixels) of the image you passed in imageUri
imageHeight number The height (in pixels) of the image you passed in imageUri
initialRotation number Number which set the default rotation of the image when cropper is initialized. Default is 0
footerComponent component Custom component for footer. Default is <DefaultFooter doneText='DONE' rotateText='ROTATE' cancelText='CANCEL' />
NOT_SELECTED_AREA_OPACITY number The opacity of the area which is not selected by the cropper. Should be a value between 0 and 1. Default is 0.5
BORDER_WIDTH number The border width (see image). Default is 50
COMPONENT_WIDTH number The width of the entire component. Default is Dimensions.get('window').width, not recommended to change.
COMPONENT_HEIGHT number The height of the entire component. Default is Dimensions.get('window').height, you should change it to fix hidden footer issue.

Usage example 1 (using the default footer)


import React, { Component } from 'react';
import AmazingCropper from 'react-native-amazing-cropper';;

class AmazingCropperPage extends Component {
  onDone = (croppedImageUri) => {
    console.log('croppedImageUri = ', croppedImageUri);
    // send image to server for example
  }

  onError = (err) => {
    console.log(err);
  }

  onCancel = () => {
    console.log('Cancel button was pressed');
    // navigate back
  }

  render() {
    return (
      <AmazingCropper
        onDone={this.onDone}
        onError={this.onError}
        onCancel={this.onCancel}
        imageUri='https://www.lifeofpix.com/wp-content/uploads/2018/09/manhattan_-11-1600x2396.jpg'
        imageWidth={1600}
        imageHeight={2396}
        NOT_SELECTED_AREA_OPACITY={0.3}
        BORDER_WIDTH={20}
      />
    );
  }
}

Usage example 2 (using the default footer with custom text)


import React, { Component } from 'react';
import AmazingCropper, { DefaultFooter } from 'react-native-amazing-cropper';

class AmazingCropperPage extends Component {
  onDone = (croppedImageUri) => {
    console.log('croppedImageUri = ', croppedImageUri);
    // send image to server for example
  }

  onError = (err) => {
    console.log(err);
  }

  onCancel = () => {
    console.log('Cancel button was pressed');
    // navigate back
  }

  render() {
    return (
      <AmazingCropper
        // Pass custom text to the default footer
        footerComponent={<DefaultFooter doneText='OK' rotateText='ROT' cancelText='BACK' />}
        onDone={this.onDone}
        onError={this.onError}
        onCancel={this.onCancel}
        imageUri='https://www.lifeofpix.com/wp-content/uploads/2018/09/manhattan_-11-1600x2396.jpg'
        imageWidth={1600}
        imageHeight={2396}
      />
    );
  }
}

Usage example 3 (using own fully customized footer)


Write your custom footer component. Don't forget to call the props.onDone, props.onRotate and props.onCancel methods inside it (the Cropper will pass them automatically to your footer component). Example of custom footer component:

import React from 'react';
import { View, TouchableOpacity, Text, Platform, StyleSheet } from 'react-native';
import PropTypes from 'prop-types';
import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons';

const CustomCropperFooter = (props) => (
  <View style={styles.buttonsContainer}>
    <TouchableOpacity onPress={props.onCancel} style={styles.touchable}>
      <Text style={styles.text}>CANCEL</Text>
    </TouchableOpacity>
    <TouchableOpacity onPress={props.onRotate} style={styles.touchable}>
      <MaterialCommunityIcon name='format-rotate-90' style={styles.rotateIcon} />
    </TouchableOpacity>
    <TouchableOpacity onPress={props.onDone} style={styles.touchable}>
      <Text style={styles.text}>DONE</Text>
    </TouchableOpacity>
  </View>
)

export default CustomCropperFooter;

CustomCropperFooter.propTypes = {
  onDone: PropTypes.func,
  onRotate: PropTypes.func,
  onCancel: PropTypes.func
}

const styles = StyleSheet.create({
  buttonsContainer: {
    flexDirection: 'row',
    alignItems: 'center', // 'flex-start'
    justifyContent: 'space-between',
    height: '100%'
  },
  text: {
    color: 'white',
    fontSize: 16
  },
  touchable: {
    padding: 10,
  },
  rotateIcon: {
    color: 'white',
    fontSize: 26,
    ...Platform.select({
      android: {
        textShadowOffset: { width: 1, height: 1 },
        textShadowColor: '#000000',
        textShadowRadius: 3,
        shadowOpacity: 0.9,
        elevation: 1
      },
      ios: {
        shadowOffset: { width: 1, height: 1 },
        shadowColor: '#000000',
        shadowRadius: 3,
        shadowOpacity: 0.9
      }
    }),
  },
})

Now just pass your footer component to the Cropper like here:

import React, { Component } from 'react';
import AmazingCropper from 'react-native-amazing-cropper';
import CustomCropperFooter from './src/components/CustomCropperFooter.component';

class AmazingCropperPage extends Component {
  onDone = (croppedImageUri) => {
    console.log('croppedImageUri = ', croppedImageUri);
    // send image to server for example
  }

  onError = (err) => {
    console.log(err);
  }

  onCancel = () => {
    console.log('Cancel button was pressed');
    // navigate back
  }

  render() {
    return (
      <AmazingCropper
        // Use your custom footer component
        // Do NOT pass onDone, onRotate and onCancel to the footer component, the Cropper will do it for you
        footerComponent={<CustomCropperFooter />}
        onDone={this.onDone}
        onError={this.onError}
        onCancel={this.onCancel}
        imageUri='https://www.lifeofpix.com/wp-content/uploads/2018/09/manhattan_-11-1600x2396.jpg'
        imageWidth={1600}
        imageHeight={2396}
      />
    );
  }
}

Did you like it? Check out also my mini applications on Google Play:

Simple Share: https://play.google.com/store/apps/details?id=com.sendfiles Card Trick: https://play.google.com/store/apps/details?id=com.card_trick_2 Swwwitch: https://play.google.com/store/apps/details?id=com.swwwitch

Do you need a mobile app for android & iOS? Hire me

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].