0

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?

Khurshid Ansari
  • 4,638
  • 2
  • 33
  • 52

2 Answers2

0

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.

Ahmet Firat Keler
  • 2,603
  • 2
  • 11
  • 22
0

On android, i have the same problem on cropping the photo. The width are inverted by the height on the new photo cropped.

I fix the problem by removing the original width and height. (But for Ios, the original width and height are important)

import ImagePicker from 'react-native-image-crop-picker'   try {
    ImagePicker.openCropper({
      path: uri,
      // width:2048,
      // height: 4096,
      includeExif: true,
      hideBottomControls: true,
      waitAnimationEnd: false,
      cropperChooseText: 'ok',
      cropperCancelText: 'Cancel',
    }).then(async image => {
      callback(image.path)
    })