Android 裁剪后的图像在本机中非常小
我想裁剪我的图像,我使用了Android 裁剪后的图像在本机中非常小,android,ios,image,react-native,image-processing,Android,Ios,Image,React Native,Image Processing,我想裁剪我的图像,我使用了@react native community/image editor 我想从base64图像中裁剪图像,所以我也使用了RNFetchBlob。这是我的密码 const file_path = RNFetchBlob.fs.dirs.DocumentDir + '/' + new Date().getTime() + '.jpg'; RNFetchBlob.fs .writeFile(file_path, this.state.image, '
@react native community/image editor
我想从base64图像中裁剪图像,所以我也使用了RNFetchBlob。这是我的密码
const file_path =
RNFetchBlob.fs.dirs.DocumentDir + '/' + new Date().getTime() + '.jpg';
RNFetchBlob.fs
.writeFile(file_path, this.state.image, 'base64')
.then(res => {
console.log(res);
ImageEditor.cropImage(
'file:///' + file_path,
{
offset: {x: topX, y: topY},
size: {width: bottomX - topX, height: bottomY - topY},
displaySize: {width: bottomX - topX, height: bottomY - topY},
},
'PNG',
).then(url => {
console.log(url);
this.setState({visible: true, cropedImage: url});
});
});
它在安卓系统上运行,但在iOS系统中,它非常小,比如20*20像素,即使我将其大小设置为1000像素以上。
我应该上传裁剪图像到服务器,所以我需要裁剪图像的文件。
谢谢您的回答。问题是我将resizeMode设置为'center',将其更改为'contain',这就解决了我的问题