我正在使用 react-native-camera 拍照。拍摄的照片是16/9的比例,但我需要它们是4/3的比例。
因此,我想裁剪图像为例如
我使用 React Native 的 ImageEditor。
我的代码如下:
但是上述代码无法正常工作。保存的照片没有被裁剪,且其大小仍为
有什么建议吗?
因此,我想裁剪图像为例如
1920*1440
。我使用 React Native 的 ImageEditor。
ImageEditor
的代码可以在这里找到。我的代码如下:
this.camera.capture(target)
.then((data) => {
let cropData = {
offset:{x:0,y:0},
size:{width:1920, height:1440}
};
ImageEditor.cropImage(
data.path,
cropData,
(uri) => {
this.props.captured(this.props.request, {
path: uri,
data: data.data,
longitude: position.coords.longitude,
latitude: position.coords.latitude
}
);
Actions.pop();
},
(error) => {});
})
.catch(err => {
console.error(err)
});
但是上述代码无法正常工作。保存的照片没有被裁剪,且其大小仍为
1440*2560
。有什么建议吗?