1
因此,我使用react-native-signature-capture来捕获签名,但我不想在编码之前减少图像大小。我用https://github.com/bamlab/react-native-image-resizer调整图像大小,但现在我不知道如何将其转换为base64。我尝试使用RN的ImageStore,但是我得到了图像文件路径的错误。见下面的代码:React Native - 调整图像大小并将其转换为base64
ImageResizer.createResizedImage(encoded.pathName, 200, 100, 'PNG', 80, null, encoded.pathName)
.then((resizedImageUrl) => {
ImageStore.getBase64ForTag(resizedImageUrl, (data) => {
console.log(data);
}, (err) => console.log(err));
})
.catch((err) => console.log('failed to resize: ' + err));