react-native-png-encoder
v0.3.0
Published
png encoder
Downloads
55
Readme
react-native-png-encoder
A simple React Native library for encoding RGB buffers into PNG files.
Installation
npm install react-native-png-encoder
yarn add react-native-png-encoder
Usage
Save an RGB buffer to an PNG file.
Saves an RGB buffer (array of color values) as a PNG file and returns the file path where the image is stored.
import { saveRgbAsPng } from 'react-native-png-encoder';
// ...
const savedFilePath = saveRgbAsPng(RGBBuffer);
// Do something with the returned file path
[!NOTE] You can use this function in conjunction with vision-camera-resize-plugin!
Clear the cache folder containing the previously saved PNG files.
Clears the cache folder by deleting previously saved PNG files and returns the count of deleted files.
import { deleteCacheFiles } from 'react-native-png-encoder';
// ...
const filesDeletedCount = deleteCacheFiles();
[!NOTE] I'd recommend on calling this function regularly (I.E. when the app becomes active), especially if you save a lot of data.
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library