Photos captured via camera are too large for efficient upload and download in React native.
Is there an api or library to compress a PNG image file in React Native?
https://github.com/bamlab/react-native-image-resizer provides an API to resize local images.
It allows you to specify:
API
import ImageResizer from 'react-native-image-resizer';
ImageResizer.createResizedImage(
imageUri,
newWidth,
newHeight,
compressFormat,
quality,
)
.then(resizedImageUri => {
// resizeImageUri is the URI of the new image that can now be displayed, uploaded...
})
.catch(err => {
// Oops, something went wrong. Check that the filename is correct and
// inspect err to get more details.
});