Skip to content

Returns the color from an image at a given coordinate.

License

Notifications You must be signed in to change notification settings

world-bit/react-native-get-pixel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Native Get Pixel

Returns the pixel color from an image at a given coordinate. Heavily inspired by https://github.com/spacesuitdiver/react-native-pixel-color

Setup

yarn add react-native-get-pixel
react-native link react-native-get-pixel

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 { getPixelRGBA } from 'react-native-get-pixel';

getPixelRGBA('sample.png', x, y)
   .then(color => console.log(color)) // [243, 123, 0]
   .catch(err => {});

NOTE: You have to add sample.png to the Xcode project as a resource and to src/main/assets/drawable on Android.

About

Returns the color from an image at a given coordinate.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published