wowmaking / react-native-image-tools

A collection of image processing tools for React Native
MIT License
59 stars 22 forks source link

react-native-image-tools-wm

A collection of image processing tools for React Native

Getting started

$ npm install react-native-image-tools-wm --save

Automatic installation

$ react-native link react-native-image-tools-wm

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-image-tools-wm and add RNImageTools.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNImageTools.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)

iOS CocoaPods

  1. Add pod 'RNImageTools', :path => '../node_modules/react-native-image-tools-wm' to your ios/Podfile
  2. Run pod install while in ios directory

Android

  1. Open up android/app/src/main/java/[...]/MainApplication.java
  1. Append the following lines to android/settings.gradle:
    include ':react-native-image-tools-wm'
    project(':react-native-image-tools-wm').projectDir = new File(rootProject.projectDir,    '../node_modules/react-native-image-tools-wm/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
     implementation project(':react-native-image-tools-wm')

    Usage

import RNImageTools from 'react-native-image-tools-wm';

See examples in the API section.

API

mask(image, maskImage)

Parameter(s)

transform(image, translateX, translateY, scale, rotate)

Parameter(s)

resize(image, width, height)

Parameter(s)

crop(image, x, y, width, height)

Parameter(s)

createMaskFromShape(options)

Creates a bitmap with white background and draws a black shape from provided points. It's intended usage is to generate mask images on the fly.

Parameter(s)

merge(images)

Parameter(s)