Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

crowtec/react-native-pixel-color

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Information

This is a fork from LeBlaaanc's library (https://github.com/leblaaanc/react-native-pixel-color).
It also uses a sightly modified version of bamblab ImageResizer (https://github.com/bamlab/react-native-image-resizer). Added Android library and fixed some iOS stuff to make it work correctly.

React Native Pixel Color

Returns the pixel color from a graphic at a given coordinate.

Setup

Install the package:

React-Native 0.29.2+

npm install --save react-native-pixel-color
react-native link react-native-pixel-color

React-Native < 0.29.2

npm install rnpm -g
rnpm install react-native-pixel-color

Android

Note: on latest versions of React Native, you may have an error during the Gradle build on Android (com.android.dex.DexException: Multiple dex files define Landroid/support/v7/appcompat/R$anim). Run cd android && ./gradlew clean to fix this.

Usage example

import PixelColor from 'react-native-pixel-color';

PixelColor.getHex(imageUriOrData, {x: x, y: y}).then((color) => {
  // #000000
}).catch((err) => {
  // Oops, something went wrong. Check that the filename is correct and
  // inspect err to get more details.
});

Sample app

Examples are found in the the examples folder.

API

promise getHex(path, coords)

The promise resolves with a string containing the uri of the new file.

Option Description
path Path of image file, or a base64 encoded image string prefixed with 'data:image/imagetype' where imagetype is jpeg or png.
coords { x: int, y: int }

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 64.7%
  • Objective-C 34.0%
  • JavaScript 1.3%