[英]How to crop image before uploading the profile picture in react native?
我需要裁剪选定的图像或从相机中拍摄的照片,然后将其上传到后端。
你可以安装sharp然后:
sharp(originalImage).extract({ width: 1920, height: 1080, left: 60, top: 40 }).toFile("outputImage")
.then(function(new_file_info) {
console.log("Image cropped and saved");
})
.catch(function(err) {
console.log("An error occured");
});
react-native-image-crop-picker是你应该使用的库
iOS / Android图像选择器,支持相机,视频,可配置压缩,多个图像和裁剪
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.