通过摄像头拍摄的照片太大,无法在React native中高效上传和下载.
是否有api或库可以在React Native中压缩PNG图像文件?
通过摄像头拍摄的照片太大,无法在React native中高效上传和下载.
是否有api或库可以在React Native中压缩PNG图像文件?
https://github.com/bamlab/react-native-image-resizer提供了调整本 map 像大小的API.
它允许您指定:
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.
});