Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Small React Native cross-platform (iOS/Android) library to scale, rotate and combine images natively

Notifications You must be signed in to change notification settings

DaBs/react-native-media-manipulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-media-manipulator

Getting started

$ npm install react-native-media-manipulator --save

Mostly automatic installation

$ react-native link react-native-media-manipulator

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-media-manipulator and add RNMediaManipulator.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNMediaManipulator.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.davidbjerremose.reactnativemediamanipulator.RNMediaManipulatorPackage; to the imports at the top of the file
  • Add new RNMediaManipulatorPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-media-manipulator'
    project(':react-native-media-manipulator').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-media-manipulator/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-media-manipulator')
    

Usage

import RNMediaManipulator from 'react-native-media-manipulator';

RNMediaManipulator.mergeImages({
  uri: 'https://example.com/image.png',
  width: 1000, // height of final image
  height: 500 // width of final image
}, [
  {
    uri: 'http://example.com/otherimage.png', // URI for other image you want merge on top of the background,
    width: 200, // width of image
    height: 200, // height of image
    scale: 1, // scale of image
    rotate: '0deg', // rotation of image
    x: 20, // x position of image
    y: 200 // y position of image
  }
]).then(uri => {
  // do something with your new image that is stored in tmp
}).catch(error => {
  // something went wrong creating the image.
})

About

Small React Native cross-platform (iOS/Android) library to scale, rotate and combine images natively

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published