Prakash
Prakash

Reputation: 466

react-native-image-picker reducing the size of the file and quality

I want to maintain the quality(size) of the image being uploaded. The options being used for this is

const options = { quality:1, maxWidth: 500, maxHeight: 500, allowsEditing: false, storageOptions: { skipBackup: true } }

Upvotes: 7

Views: 20802

Answers (2)

Sanjay Parihar
Sanjay Parihar

Reputation: 1

    let options = {
      quality:1, 
      allowsEditing: false,
      noData:true, 
      storageOptions: { skipBackup: true }}
    launchCamera(options, response => {
      if (response.didCancel) {
        console.log('User cancelled image picker');
      } else if (response.error) {
        console.log('ImagePicker Error:',response.error);
      } else {
        handleUploadPhoto(response.assets[0]);
      }
    });

Upvotes: 0

Andrew
Andrew

Reputation: 28539

Remove the maxWidth and maxHeight from the options. That is what is reducing the size of the image.

You can see more of the options the api allows here https://github.com/react-native-community/react-native-image-picker/

Upvotes: 9

Related Questions