├── .npmignore ├── ExampleApp ├── .watchmanconfig ├── .gitattributes ├── app.json ├── image.jpg ├── babel.config.js ├── balloons.png ├── android │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── values │ │ │ │ │ │ ├── strings.xml │ │ │ │ │ │ └── styles.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ └── mipmap-xxxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── exampleapp │ │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ │ └── MainApplication.java │ │ │ │ └── AndroidManifest.xml │ │ │ └── debug │ │ │ │ └── AndroidManifest.xml │ │ ├── build_defs.bzl │ │ ├── proguard-rules.pro │ │ ├── BUCK │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── keystores │ │ ├── debug.keystore.properties │ │ └── BUCK │ ├── settings.gradle │ ├── gradle.properties │ ├── build.gradle │ ├── gradlew.bat │ └── gradlew ├── ios │ ├── ExampleApp │ │ ├── Images.xcassets │ │ │ ├── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── AppDelegate.h │ │ ├── main.m │ │ ├── AppDelegate.m │ │ ├── Info.plist │ │ └── Base.lproj │ │ │ └── LaunchScreen.xib │ ├── Podfile │ ├── ExampleAppTests │ │ ├── Info.plist │ │ └── ExampleAppTests.m │ ├── ExampleApp-tvOSTests │ │ └── Info.plist │ ├── Podfile.lock │ ├── ExampleApp-tvOS │ │ └── Info.plist │ └── ExampleApp.xcodeproj │ │ ├── xcshareddata │ │ └── xcschemes │ │ │ ├── ExampleApp.xcscheme │ │ │ └── ExampleApp-tvOS.xcscheme │ │ └── project.pbxproj ├── .buckconfig ├── index.js ├── __tests__ │ └── App-test.js ├── package.json ├── metro.config.js ├── .gitignore ├── .flowconfig └── App.js ├── .gitattributes ├── index.js ├── android ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── net │ │ └── wowmaking │ │ ├── RNImageToolsPackage.java │ │ ├── RNImageToolsModule.java │ │ └── Utility.java └── build.gradle ├── ios ├── RNImageTools.h ├── RNImageTools.xcworkspace │ └── contents.xcworkspacedata ├── RNImageTools.xcodeproj │ └── project.pbxproj └── RNImageTools.m ├── .gitignore ├── package.json ├── RNImageTools.podspec ├── LICENSE.md └── README.md /.npmignore: -------------------------------------------------------------------------------- 1 | ExampleApp -------------------------------------------------------------------------------- /ExampleApp/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text -------------------------------------------------------------------------------- /ExampleApp/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /ExampleApp/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ExampleApp", 3 | "displayName": "ExampleApp" 4 | } -------------------------------------------------------------------------------- /ExampleApp/image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wowmaking/react-native-image-tools/HEAD/ExampleApp/image.jpg -------------------------------------------------------------------------------- /ExampleApp/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /ExampleApp/balloons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wowmaking/react-native-image-tools/HEAD/ExampleApp/balloons.png -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ExampleApp 3 | 4 | -------------------------------------------------------------------------------- /ExampleApp/ios/ExampleApp/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import { NativeModules } from 'react-native'; 2 | 3 | const { RNImageTools } = NativeModules; 4 | 5 | export default RNImageTools; 6 | -------------------------------------------------------------------------------- /ExampleApp/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /ExampleApp/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wowmaking/react-native-image-tools/HEAD/ExampleApp/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /ExampleApp/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wowmaking/react-native-image-tools/HEAD/ExampleApp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wowmaking/react-native-image-tools/HEAD/ExampleApp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wowmaking/react-native-image-tools/HEAD/ExampleApp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wowmaking/react-native-image-tools/HEAD/ExampleApp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wowmaking/react-native-image-tools/HEAD/ExampleApp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wowmaking/react-native-image-tools/HEAD/ExampleApp/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wowmaking/react-native-image-tools/HEAD/ExampleApp/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wowmaking/react-native-image-tools/HEAD/ExampleApp/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wowmaking/react-native-image-tools/HEAD/ExampleApp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wowmaking/react-native-image-tools/HEAD/ExampleApp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ExampleApp/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /ExampleApp/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /ios/RNImageTools.h: -------------------------------------------------------------------------------- 1 | 2 | #if __has_include("RCTBridgeModule.h") 3 | #import "RCTBridgeModule.h" 4 | #else 5 | #import 6 | #endif 7 | 8 | @interface RNImageTools : NSObject 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /ExampleApp/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'ExampleApp' 2 | 3 | include ':react-native-image-tools-wm' 4 | project(':react-native-image-tools-wm').projectDir = new File(rootProject.projectDir, '../../android') 5 | 6 | include ':app' 7 | -------------------------------------------------------------------------------- /ios/RNImageTools.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | 3 | 5 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ExampleApp/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /ExampleApp/__tests__/App-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../App'; 8 | 9 | // Note: test renderer must be required after react-native. 10 | import renderer from 'react-test-renderer'; 11 | 12 | it('renders correctly', () => { 13 | renderer.create(); 14 | }); 15 | -------------------------------------------------------------------------------- /ExampleApp/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ExampleApp/ios/ExampleApp/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic, strong) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ExampleApp/ios/ExampleApp/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/java/com/exampleapp/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.exampleapp; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "ExampleApp"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ExampleApp/ios/Podfile: -------------------------------------------------------------------------------- 1 | target 'ExampleApp' do 2 | 3 | platform :ios, '9.0' 4 | 5 | pod "yoga", :path => "../node_modules/react-native/ReactCommon/yoga" 6 | pod 'React', :path => '../node_modules/react-native' 7 | 8 | # Pods for node_modules 9 | pod 'RNImageTools', :path => '../../RNImageTools.podspec' 10 | end 11 | 12 | 13 | post_install do |installer| 14 | installer.pods_project.targets.each do |target| 15 | if target.name == "React" 16 | target.remove_from_project 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # OSX 3 | # 4 | .DS_Store 5 | 6 | # node.js 7 | # 8 | node_modules/ 9 | npm-debug.log 10 | yarn-error.log 11 | 12 | 13 | # Xcode 14 | # 15 | build/ 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | xcuserdata 25 | *.xccheckout 26 | *.moved-aside 27 | DerivedData 28 | *.hmap 29 | *.ipa 30 | *.xcuserstate 31 | project.xcworkspace 32 | 33 | 34 | # Android/IntelliJ 35 | # 36 | build/ 37 | .idea 38 | .gradle 39 | local.properties 40 | *.iml 41 | 42 | # BUCK 43 | buck-out/ 44 | \.buckd/ 45 | *.keystore 46 | -------------------------------------------------------------------------------- /ExampleApp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ExampleApp", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "test": "jest" 8 | }, 9 | "dependencies": { 10 | "react": "16.8.3", 11 | "react-native": "0.59.10" 12 | }, 13 | "devDependencies": { 14 | "@babel/core": "7.6.2", 15 | "@babel/runtime": "7.6.2", 16 | "babel-jest": "24.9.0", 17 | "jest": "24.9.0", 18 | "metro-react-native-babel-preset": "0.56.0", 19 | "react-test-renderer": "16.8.3" 20 | }, 21 | "jest": { 22 | "preset": "react-native" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-image-tools-wm", 3 | "version": "1.5.7", 4 | "description": "A collection of image processing tools for React Native", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [ 10 | "react-native", 11 | "image", 12 | "edit", 13 | "processing", 14 | "mask" 15 | ], 16 | "author": "Dmitry Kazlouski", 17 | "license": "MIT", 18 | "peerDependencies": { 19 | "react-native": ">=0.41.2" 20 | }, 21 | "repository": { 22 | "type": "git", 23 | "url": "https://github.com/wowmaking/react-native-image-tools" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ExampleApp/android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /ExampleApp/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /ExampleApp/ios/ExampleApp/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ExampleApp/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | const path = require('path'); 9 | 10 | module.exports = { 11 | transformer: { 12 | getTransformOptions: async () => ({ 13 | transform: { 14 | experimentalImportSupport: false, 15 | inlineRequires: false, 16 | }, 17 | }), 18 | }, 19 | resolver: { 20 | extraNodeModules: { // peer dependencies 21 | '@babel/runtime': path.resolve(__dirname, 'node_modules/@babel/runtime'), 22 | 'react': path.resolve(__dirname, 'node_modules/react'), 23 | 'react-native': path.resolve(__dirname, 'node_modules/react-native'), 24 | }, 25 | }, 26 | watchFolders: [path.resolve(__dirname, '..')], // lib source 27 | }; 28 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | def safeExtGet(prop, fallback) { 2 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback 3 | } 4 | 5 | apply plugin: 'com.android.library' 6 | 7 | android { 8 | compileSdkVersion safeExtGet('compileSdkVersion', 26) 9 | buildToolsVersion safeExtGet('buildToolsVersion', "26.0.3") 10 | 11 | defaultConfig { 12 | minSdkVersion safeExtGet('minSdkVersion', 16) 13 | targetSdkVersion safeExtGet('targetSdkVersion', 26) 14 | versionCode 1 15 | versionName "1.0" 16 | } 17 | lintOptions { 18 | abortOnError false 19 | } 20 | } 21 | 22 | repositories { 23 | mavenCentral() 24 | } 25 | 26 | dependencies { 27 | implementation 'com.facebook.react:react-native:+' 28 | implementation "com.android.support:exifinterface:${safeExtGet('supportLibVersion', '27.1.0')}" 29 | } 30 | -------------------------------------------------------------------------------- /ExampleApp/ios/ExampleAppTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ExampleApp/ios/ExampleApp-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /RNImageTools.podspec: -------------------------------------------------------------------------------- 1 | require "json" 2 | version = JSON.parse(File.read("package.json"))["version"] 3 | 4 | Pod::Spec.new do |s| 5 | s.name = "RNImageTools" 6 | s.version = version 7 | s.summary = "RNImageTools" 8 | s.description = <<-DESC 9 | A collection of image processing tools for React Native 10 | DESC 11 | s.homepage = "https://github.com/wowmaking/react-native-image-tools" 12 | s.license = "MIT" 13 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" } 14 | s.author = { "Dmitry Kazlouski" => "dkazlouski@wowmaking.net" } 15 | s.platform = :ios, "7.0" 16 | s.source = { :git => "https://github.com/wowmaking/react-native-image-tools", tag: "v" + s.version.to_s } 17 | s.source_files = "ios/**/*.{h,m}" 18 | s.requires_arc = true 19 | 20 | 21 | s.dependency "React" 22 | #s.dependency "others" 23 | 24 | end 25 | 26 | -------------------------------------------------------------------------------- /ExampleApp/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - React (0.59.10): 3 | - React/Core (= 0.59.10) 4 | - React/Core (0.59.10): 5 | - yoga (= 0.59.10.React) 6 | - RNImageTools (1.5.6): 7 | - React 8 | - yoga (0.59.10.React) 9 | 10 | DEPENDENCIES: 11 | - React (from `../node_modules/react-native`) 12 | - RNImageTools (from `../../RNImageTools.podspec`) 13 | - yoga (from `../node_modules/react-native/ReactCommon/yoga`) 14 | 15 | EXTERNAL SOURCES: 16 | React: 17 | :path: "../node_modules/react-native" 18 | RNImageTools: 19 | :path: "../../RNImageTools.podspec" 20 | yoga: 21 | :path: "../node_modules/react-native/ReactCommon/yoga" 22 | 23 | SPEC CHECKSUMS: 24 | React: 36d0768f9e93be2473b37e7fa64f92c1d5341eef 25 | RNImageTools: cdf1c3d8ec14146a68629c208cec1a99d50ac37e 26 | yoga: 684513b14b03201579ba3cee20218c9d1298b0cc 27 | 28 | PODFILE CHECKSUM: 61fedfff81b829088bc81c766b2aafa4a68aef94 29 | 30 | COCOAPODS: 1.7.5 31 | -------------------------------------------------------------------------------- /ExampleApp/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | -------------------------------------------------------------------------------- /ExampleApp/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "28.0.3" 6 | minSdkVersion = 16 7 | compileSdkVersion = 28 8 | targetSdkVersion = 28 9 | supportLibVersion = "28.0.0" 10 | } 11 | repositories { 12 | google() 13 | jcenter() 14 | } 15 | dependencies { 16 | classpath("com.android.tools.build:gradle:3.4.0") 17 | 18 | // NOTE: Do not place your application dependencies here; they belong 19 | // in the individual module build.gradle files 20 | } 21 | } 22 | 23 | allprojects { 24 | repositories { 25 | mavenLocal() 26 | google() 27 | jcenter() 28 | maven { 29 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 30 | url "$rootDir/../node_modules/react-native/android" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /android/src/main/java/net/wowmaking/RNImageToolsPackage.java: -------------------------------------------------------------------------------- 1 | 2 | package net.wowmaking; 3 | 4 | import java.util.Arrays; 5 | import java.util.Collections; 6 | import java.util.List; 7 | 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.bridge.NativeModule; 10 | import com.facebook.react.bridge.ReactApplicationContext; 11 | import com.facebook.react.uimanager.ViewManager; 12 | import com.facebook.react.bridge.JavaScriptModule; 13 | public class RNImageToolsPackage implements ReactPackage { 14 | @Override 15 | public List createNativeModules(ReactApplicationContext reactContext) { 16 | return Arrays.asList(new RNImageToolsModule(reactContext)); 17 | } 18 | 19 | // Deprecated from RN 0.47 20 | public List> createJSModules() { 21 | return Collections.emptyList(); 22 | } 23 | 24 | @Override 25 | public List createViewManagers(ReactApplicationContext reactContext) { 26 | return Collections.emptyList(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ExampleApp/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | 58 | ios/Pods -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the “Software”), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ExampleApp/android/app/src/main/java/com/exampleapp/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.exampleapp; 2 | 3 | import android.app.Application; 4 | 5 | import net.wowmaking.RNImageToolsPackage; 6 | 7 | import com.facebook.react.ReactApplication; 8 | import com.facebook.react.ReactNativeHost; 9 | import com.facebook.react.ReactPackage; 10 | import com.facebook.react.shell.MainReactPackage; 11 | import com.facebook.soloader.SoLoader; 12 | 13 | import java.util.Arrays; 14 | import java.util.List; 15 | 16 | public class MainApplication extends Application implements ReactApplication { 17 | 18 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 19 | @Override 20 | public boolean getUseDeveloperSupport() { 21 | return BuildConfig.DEBUG; 22 | } 23 | 24 | @Override 25 | protected List getPackages() { 26 | return Arrays.asList( 27 | new MainReactPackage(), 28 | new RNImageToolsPackage() 29 | ); 30 | } 31 | 32 | @Override 33 | protected String getJSMainModuleName() { 34 | return "index"; 35 | } 36 | }; 37 | 38 | @Override 39 | public ReactNativeHost getReactNativeHost() { 40 | return mReactNativeHost; 41 | } 42 | 43 | @Override 44 | public void onCreate() { 45 | super.onCreate(); 46 | SoLoader.init(this, /* native exopackage */ false); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ExampleApp/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.exampleapp", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.exampleapp", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /ExampleApp/ios/ExampleApp/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | #import 12 | #import 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 19 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 20 | moduleName:@"ExampleApp" 21 | initialProperties:nil]; 22 | 23 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 24 | 25 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 26 | UIViewController *rootViewController = [UIViewController new]; 27 | rootViewController.view = rootView; 28 | self.window.rootViewController = rootViewController; 29 | [self.window makeKeyAndVisible]; 30 | return YES; 31 | } 32 | 33 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 34 | { 35 | #if DEBUG 36 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 37 | #else 38 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 39 | #endif 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /ExampleApp/ios/ExampleApp-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /ExampleApp/ios/ExampleApp/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ExampleApp 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSLocationWhenInUseUsageDescription 28 | 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UIViewControllerBasedStatusBarAppearance 42 | 43 | NSLocationWhenInUseUsageDescription 44 | 45 | NSAppTransportSecurity 46 | 47 | 48 | NSAllowsArbitraryLoads 49 | 50 | NSExceptionDomains 51 | 52 | localhost 53 | 54 | NSExceptionAllowsInsecureHTTPLoads 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /ExampleApp/ios/ExampleAppTests/ExampleAppTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | #import 12 | #import 13 | 14 | #define TIMEOUT_SECONDS 600 15 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 16 | 17 | @interface ExampleAppTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation ExampleAppTests 22 | 23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 24 | { 25 | if (test(view)) { 26 | return YES; 27 | } 28 | for (UIView *subview in [view subviews]) { 29 | if ([self findSubviewInView:subview matching:test]) { 30 | return YES; 31 | } 32 | } 33 | return NO; 34 | } 35 | 36 | - (void)testRendersWelcomeScreen 37 | { 38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 40 | BOOL foundElement = NO; 41 | 42 | __block NSString *redboxError = nil; 43 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 44 | if (level >= RCTLogLevelError) { 45 | redboxError = message; 46 | } 47 | }); 48 | 49 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 50 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 51 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 52 | 53 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 54 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 55 | return YES; 56 | } 57 | return NO; 58 | }]; 59 | } 60 | 61 | RCTSetLogFunction(RCTDefaultLogFunction); 62 | 63 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 64 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 65 | } 66 | 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /ExampleApp/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore unexpected extra "@providesModule" 9 | .*/node_modules/.*/node_modules/fbjs/.* 10 | 11 | ; Ignore duplicate module providers 12 | ; For RN Apps installed via npm, "Libraries" folder is inside 13 | ; "node_modules/react-native" but in the source repo it is in the root 14 | .*/Libraries/react-native/React.js 15 | 16 | ; Ignore polyfills 17 | .*/Libraries/polyfills/.* 18 | 19 | ; Ignore metro 20 | .*/node_modules/metro/.* 21 | 22 | [include] 23 | 24 | [libs] 25 | node_modules/react-native/Libraries/react-native/react-native-interface.js 26 | node_modules/react-native/flow/ 27 | 28 | [options] 29 | emoji=true 30 | 31 | esproposal.optional_chaining=enable 32 | esproposal.nullish_coalescing=enable 33 | 34 | module.system=haste 35 | module.system.haste.use_name_reducers=true 36 | # get basename 37 | module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' 38 | # strip .js or .js.flow suffix 39 | module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' 40 | # strip .ios suffix 41 | module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' 42 | module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' 43 | module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' 44 | module.system.haste.paths.blacklist=.*/__tests__/.* 45 | module.system.haste.paths.blacklist=.*/__mocks__/.* 46 | module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* 47 | module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* 48 | 49 | munge_underscores=true 50 | 51 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 52 | 53 | module.file_ext=.js 54 | module.file_ext=.jsx 55 | module.file_ext=.json 56 | module.file_ext=.native.js 57 | 58 | suppress_type=$FlowIssue 59 | suppress_type=$FlowFixMe 60 | suppress_type=$FlowFixMeProps 61 | suppress_type=$FlowFixMeState 62 | 63 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 64 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 65 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 66 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 67 | 68 | [version] 69 | ^0.92.0 70 | -------------------------------------------------------------------------------- /ExampleApp/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem http://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /ExampleApp/ios/ExampleApp/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ExampleApp/ios/ExampleApp.xcodeproj/xcshareddata/xcschemes/ExampleApp.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-image-tools-wm 2 | A collection of image processing tools for React Native 3 | 4 | ## Getting started 5 | 6 | `$ npm install react-native-image-tools-wm --save` 7 | 8 | ### Automatic installation 9 | 10 | `$ react-native link react-native-image-tools-wm` 11 | 12 | ### Manual installation 13 | 14 | #### iOS 15 | 16 | 1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]` 17 | 2. Go to `node_modules` ➜ `react-native-image-tools-wm` and add `RNImageTools.xcodeproj` 18 | 3. In XCode, in the project navigator, select your project. Add `libRNImageTools.a` to your project's `Build Phases` ➜ `Link Binary With Libraries` 19 | 4. Run your project (`Cmd+R`) 20 | 21 | #### iOS CocoaPods 22 | 1. Add `pod 'RNImageTools', :path => '../node_modules/react-native-image-tools-wm'` to your `ios/Podfile` 23 | 2. Run `pod install` while in `ios` directory 24 | 25 | #### Android 26 | 27 | 1. Open up `android/app/src/main/java/[...]/MainApplication.java` 28 | 29 | - Add `import net.wowmaking.RNImageToolsPackage;` to the imports at the top of the file 30 | - Add `new RNImageToolsPackage()` to the list returned by the `getPackages()` method 31 | 32 | 2. Append the following lines to `android/settings.gradle`: 33 | ``` 34 | include ':react-native-image-tools-wm' 35 | project(':react-native-image-tools-wm').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-tools-wm/android') 36 | ``` 37 | 3. Insert the following lines inside the dependencies block in `android/app/build.gradle`: 38 | ``` 39 | implementation project(':react-native-image-tools-wm') 40 | ``` 41 | ## Usage 42 | 43 | ```javascript 44 | import RNImageTools from 'react-native-image-tools-wm'; 45 | ``` 46 | See examples in the API section. 47 | 48 | ## API 49 | ### mask(image, maskImage) 50 | #### Parameter(s) 51 | * **image:** String - path to image 52 | * **maskImage:** String - path to mask image 53 | * **options:** Object 54 | * **trimTransparency:** Boolean 55 | #### Returns Promise of 56 | * **maskedImage:** Object 57 | * **uri:** String 58 | * **width:** Number 59 | * **height:** Number 60 | ```javascript 61 | RNImageTools.mask(image, maskImage, { 62 | trimTransparency: true 63 | }).then(({ uri, width, height }) => { 64 | // Sync with your app state 65 | }).catch(console.error); 66 | ``` 67 | 68 | 69 | ### transform(image, translateX, translateY, scale, rotate) 70 | #### Parameter(s) 71 | * **image:** String - path to image 72 | * **translateX:** Number 73 | * **translateY:** Number 74 | * **scale:** Number 75 | * **rotate:** Number - in degrees 76 | #### Returns Promise of 77 | * **transformedImage:** Object 78 | * **uri:** String 79 | * **width:** Number 80 | * **height:** Number 81 | ```javascript 82 | RNImageTools.transform(image, 10, -10, 1.25, 45) 83 | .then(({ uri, width, height }) => { 84 | // Sync with your app state 85 | }) 86 | .catch(console.error); 87 | ``` 88 | 89 | 90 | ### resize(image, width, height) 91 | #### Parameter(s) 92 | * **image:** String - path to image 93 | * **width:** Number 94 | * **height:** Number - in degrees 95 | #### Returns Promise of 96 | * **resizedImage:** Object 97 | * **uri:** String 98 | * **width:** Number 99 | * **height:** Number 100 | ```javascript 101 | RNImageTools.resize(image, 500, 500) 102 | .then(({ uri, width, height }) => { 103 | // Sync with your app state 104 | }) 105 | .catch(console.error); 106 | ``` 107 | 108 | 109 | ### crop(image, x, y, width, height) 110 | #### Parameter(s) 111 | * **image:** String - path to image 112 | * **x:** Number - top offset 113 | * **y:** Number - left offset 114 | * **width:** Number 115 | * **height:** Number 116 | #### Returns Promise of 117 | * **croppedImage:** Object 118 | * **uri:** String 119 | * **width:** Number 120 | * **height:** Number 121 | ```javascript 122 | RNImageTools.crop(image, 100, 100, 500, 500) 123 | .then(({ uri, width, height }) => { 124 | // Sync with your app state 125 | }) 126 | .catch(console.error); 127 | ``` 128 | 129 | 130 | ### createMaskFromShape(options) 131 | 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. 132 | #### Parameter(s) 133 | * **options:** Object 134 | * **points:** Array of points 135 | * **point:** Object 136 | * **x:** Number 137 | * **y:** Number 138 | * **width:** Number 139 | * **height:** Number 140 | * **inverted:** Boolean 141 | #### Returns Promise of 142 | * **maskImage:** Object 143 | * **uri:** String 144 | * **width:** Number 145 | * **height:** Number 146 | ```javascript 147 | RNImageTools.createMaskFromShape({ 148 | points: [ 149 | { x: 20, y: 20 }, 150 | { x: 200, y: 200 }, 151 | { x: 200, y: 20 }, 152 | { x: 20, y: 20 }, 153 | ], 154 | width: 500, 155 | height: 500, 156 | inverted: false, 157 | }).then(({ uri, width, height }) => { 158 | // Sync with your app state 159 | }).catch(console.error); 160 | ``` 161 | 162 | ### merge(images) 163 | #### Parameter(s) 164 | * **images:** Array 165 | * **uri:** String - path to image 166 | #### Returns Promise of 167 | * **mergedImage:** Object 168 | * **uri:** String 169 | * **width:** Number 170 | * **height:** Number 171 | ```javascript 172 | RNImageTools.merge( 173 | [ 174 | image1, 175 | image2, 176 | image3, 177 | ] 178 | ).then(({ uri, width, height }) => { 179 | // Sync with your app state 180 | }).catch(console.error); 181 | ``` -------------------------------------------------------------------------------- /ExampleApp/ios/ExampleApp.xcodeproj/xcshareddata/xcschemes/ExampleApp-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /ExampleApp/App.js: -------------------------------------------------------------------------------- 1 | import React, {Component} from 'react'; 2 | import { 3 | StyleSheet, 4 | Text, 5 | View, 6 | ScrollView, 7 | TouchableOpacity, 8 | SafeAreaView, 9 | Image, 10 | } from 'react-native'; 11 | import RNImageTools from 'react-native-image-tools-wm'; 12 | 13 | const assetSource = Image.resolveAssetSource(require('./image.jpg')); 14 | const balloonsAssetSource = Image.resolveAssetSource(require('./balloons.png')); 15 | 16 | const TARGET_IMAGE_WIDTH = 200; 17 | const TARGET_IMAGE_HEIGHT = 200; 18 | 19 | const Button = ({ text, onPress }) => ( 20 | 21 | {text} 22 | 23 | ); 24 | 25 | export default class App extends Component { 26 | 27 | state = { 28 | previewImageSource: null, 29 | }; 30 | 31 | handleResizeImage = () => { 32 | RNImageTools.resize(assetSource.uri, TARGET_IMAGE_WIDTH, TARGET_IMAGE_HEIGHT).then(result => { 33 | this.setState({ 34 | previewImageSource: result 35 | }); 36 | }).catch(console.error); 37 | }; 38 | 39 | handleCropImage = () => { 40 | RNImageTools.crop(assetSource.uri, 50, 50, TARGET_IMAGE_WIDTH, TARGET_IMAGE_HEIGHT).then(result => { 41 | this.setState({ 42 | previewImageSource: result 43 | }); 44 | }).catch(console.error); 45 | }; 46 | 47 | handleCreateMask = () => { 48 | RNImageTools.createMaskFromShape({ 49 | points: [ 50 | { x: 10, y: 10 }, 51 | { x: 80, y: 80 }, 52 | { x: 80, y: 10 }, 53 | { x: 10, y: 10 }, 54 | ], 55 | width: TARGET_IMAGE_WIDTH, 56 | height: TARGET_IMAGE_HEIGHT, 57 | inverted: true, 58 | }).then(result => { 59 | this.setState({ 60 | previewImageSource: result 61 | }); 62 | }).catch(console.error); 63 | }; 64 | 65 | handleMaskImage = () => { 66 | RNImageTools.createMaskFromShape({ 67 | points: [ 68 | { x: 10, y: 10 }, 69 | { x: 80, y: 80 }, 70 | { x: 80, y: 10 }, 71 | { x: 10, y: 10 }, 72 | ], 73 | width: TARGET_IMAGE_WIDTH, 74 | height: TARGET_IMAGE_HEIGHT, 75 | inverted: true, 76 | }).then(maskImage => { 77 | return RNImageTools.mask(assetSource.uri, maskImage.uri, { 78 | trimTransparency: true 79 | }).then(maskedImage => { 80 | this.setState({ 81 | previewImageSource: maskedImage 82 | }); 83 | }).catch(console.error); 84 | }).catch(console.error); 85 | }; 86 | 87 | handleMergeImages = () => { 88 | RNImageTools.merge([ 89 | assetSource.uri, 90 | balloonsAssetSource.uri, 91 | ]).then(mergedImage => { 92 | this.setState({ 93 | previewImageSource: mergedImage 94 | }); 95 | }).catch(console.error); 96 | }; 97 | 98 | handleTransformImage = () => { 99 | RNImageTools.transform(balloonsAssetSource.uri, 10, -10, 0.9, 45).then(result => { 100 | this.setState({ 101 | previewImageSource: result 102 | }); 103 | }).catch(console.error); 104 | }; 105 | 106 | 107 | render() { 108 | return ( 109 | 110 | 111 | 112 | Preview 113 | 114 | {this.state.previewImageSource ? ( 115 | 116 | ) : ( 117 | No image 118 | )} 119 | 120 | 121 | 122 | Methods 123 | 124 |