首页 > 解决方案 > ImagePicker EXPO 长宽比

问题描述

早上好!我想问一些事情,我正在锻炼中,当我使用 Expo 的 ImagePicker 时,为什么当我选择一些图像时,我总是得到纵横比 [4,4]?即使我只是删除了纵横比参数

这是代码:

const pickImage = async () => {
    let result = await ImagePicker.launchImageLibraryAsync({
      mediaTypes: ImagePicker.MediaTypeOptions.All,
      // aspect: [4, 4],
      quality: 1,
    });

    console.log(result);

    if (!result.cancelled) {
      const manipResult = await ImageManipulator.manipulateAsync(
        result.uri,
        [{ resize: { width: result.height / 4, height: result.width / 4 } }],
        { compress: 1, format: ImageManipulator.SaveFormat.JPEG }
      );
      console.log("MANIP: " + JSON.stringify(manipResult.uri));
      uploadFoto(manipResult.uri);
    }
  };

这是我得到的图像: 这是问题

original aspect那张图片/图像是,18:9那为什么我得到那个纵横比?请有人帮忙:(

标签: react-nativeexpoimagepicker

解决方案


推荐阅读