react-native-pixel-image

1.0.1 • Public • Published

react-native-pixel-image

npm version npm downloads npm licence Platform

Parse image file to ImageData for React Native

Installation

$ npm install react-native-pixel-image

For RN >= 0.65, run npm install react-native-blob-util.

For RN < 0.65, run npm install react-native-blob-util@0.16.3, and patch manually to fix: with react-native-web product build will export 'URIUtil' (reexported as 'URIUtil') was not found.

var pixel= require('react-native-pixel-image');
console.log(pixel); //object

API

pixel(file) -> Promise<ImageData[]>

return images is Array contains one or more ImageData.

images can be resized and also keep property e.g. delay by resizeImageDatas of react-native-pixel-util.

file is...

  • string: url (e.g. http[s]://...)
  • string: datauri (e.g. data:image/... which can comes from data-uri.macro)
  • string: path (e.g. /storage/emulated/0/Pictures/gifs/ani (1).gif on Android, file:///private/var/mobile/Containers/.../foo.png on iOS)
  • string: binary (unless above)
  • object: Blob/File
  • object: Buffer/ArrayBuffer/Uint8Array/Uint8ClampedArray
  • object: HTMLImageElement

Support

  • gif (static/animation)
  • png (static/animation)
  • jpeg
  • bitmap (32bit or less)
  • webp (static/animation)

Related projects

License

MIT

Package Sidebar

Install

npm i react-native-pixel-image

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

8.25 kB

Total Files

4

Last publish

Collaborators

  • flyskywhy