androidreact-nativereact-native-image-picker

react-native-image-picker getting reverse height and width


I am using react-native-image-picker library to capture image code as follow:

launchImageLibrary({
   includeExtra: false,
   mediaType: "photo",
   selectionLimit: 0,
   quality: 1,
   maxWidth: 1000,
   maxHeight: 1500
}, (res)=>{
   console.log(res);
});

When I am taking capture using android real device(portrait) getting image with following:

{
   uri: "string",
   height: 1000,
   width: 750
}

Expected and correct response:

{
   uri: "string",
   height: 750,
   width: 1000
}

can someone help me out?


Solution

  • I advice you to use react-native-image-crop-picker library.

    The code below works for me. You can use it without cropping if you do not need it.

    import ImagePicker from 'react-native-image-crop-picker';
    
    ImagePicker.openCamera({
      width: 768,
      height: 1024,
      cropping: false,
    }).then(image => {
      console.log(image)
    })
    

    Looks like we have same aspect ratio 3/4. So I guess it may help you.