裁剪图像至一定尺寸

时间:2019-11-24 16:58:20

标签: react-native expo react-native-camera

Hi there!

嗨,有什么方法可以只切出带有黄色边框的空间?

我已经在博览会上使用ImageManipulator进行了一些测试,但这是非常错误的。

  const transFormImage = async photo => {
    const manipResult = await ImageManipulator.manipulateAsync(photo.uri, [
      {
        crop: {
          originX: 0,
          originY: (photo.height - photo.width) / 2,
          width: (photo.width * 0.9) / 2,
          height: (photo.height * 0.2) / 2
        }
      }
    ]);
    setTransform(manipResult.uri);
  };

如果有更好的解决方案。我将不胜感激。

谢谢

0 个答案:

没有答案