2

I am using react-native-image-picker to select images from gallery, but react-native-image-picker not reducing image quality after selecting an image. Both original and compressed images size are the same. How to reduce image quality by using react-native-image-picker?

import { launchImageLibrary } from 'react-native-image-picker';

const chooseFile = () => {
        let options = {
            mediaType: 'photo',
            quality: 0.5,
        };
        launchImageLibrary(options, (response) => {
            console.log('Response = ', response);
        });
    };
Shivam
  • 2,147
  • 1
  • 11
  • 28

1 Answers1

0
import { launchImageLibrary } from 'react-native-image-picker';
const chooseFile = () => {
    let options = {
        mediaType: 'photo',
        maxHeight: 1000, //any number lesser will resize the image to a lower quality
    };
    launchImageLibrary(options, (response) => {
        console.log('Response = ', response);
    });
};

use the maxHeight or maxWidth to resize the image to lower quality image

Abdul Kabir
  • 118
  • 9