Coder Social home page Coder Social logo

priyankachoudhary221614 / react-native-image-crop-tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hhunaid/react-native-image-crop-tools

0.0 0.0 0.0 13.31 MB

Native-ish Image Crop Tools for react native

Objective-C 45.63% Ruby 5.73% Kotlin 36.08% TypeScript 12.56%

react-native-image-crop-tools's Introduction

react-native-image-crop-tools

Previews

Getting started

$ yarn add react-native-image-crop-tools

Mostly Automatic installation

Only RN > 0.61.x is supported.

  • Android: Installation is automatic.
  • iOS: Add pod 'react-native-image-crop-tools', :path => '../node_modules/react-native-image-crop-tools' in your podfile below the line use_native_modules!. Then run pod installin iOS folder.

Why another cropping library?

Most cropping tools available for RN are usually wrappers over popular native tools which itself isn't a bad thing. But this means you are stuck with their UI and feature set. The ones made in RN are not the most optimized and correct tools.

Features

  1. Native views. Which means performance even on low end devices.
  2. You can embed the view into you own UI. It's not very customizable (yet)
  3. Change and lock/unlock aspect ratio on the fly (This is the main reason I am making this library)

NOTE

This library is not supposed to work with local images. There are very few usecases for that. You need to provide a sourceUrl string which you can obtain from image pickers or downloading using rn-fetch-blob

Usage

import { CropView } from 'react-native-image-crop-tools';

        <CropView
          sourceUrl={uri}
          style={styles.cropView}
          ref={cropViewRef}
          onImageCrop={(res) => console.warn(res)}
          keepAspectRatio
          aspectRatio={{width: 16, height: 9}}
        />

Two methods are exposed on the ref you can use them as follows

  this.cropViewRef.saveImage(true, 90 // image quality percentage)
  this.cropViewRef.rotateImage(true // true for clockwise, false for counterclockwise)

For detailed usage check out the example app.

TODO:

  • Add screenshots
  • Support transparency
  • Add access to prebuilt UI for those who want to use it.

react-native-image-crop-tools's People

Contributors

hhunaid avatar priyankachoudhary221614 avatar adrianocola avatar jimteva avatar moemamdouh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.