Image picker returned image height and width units

#1

Actually I am using ImagePicker SDK of expo. I went through the documentation but was unable to find out the height and width of the image returned by ImagePicker.Can any one please help me with this?

#2

Hey @clearviewsocial,

Can you create a Snack (snack.expo.io) with your code so I can take a look and see if anything is incorrect?

Cheers,

Adam

#3

Actually I have created a function which returns an object containing the details about the image.
Here is the function which I call when pic is clicked from camera:

/**
 * To launch camera and take photo.
 */
export const takePhoto = async () => {
    return ImagePicker.launchCameraAsync({
        allowsEditing: true,
        quality: 0.2,
        aspect: [4, 3]
    });
};

And this is the function through which I am calling the above function:

 _onImageCropSelect = async (option: string) => {
        try {
            const selectedOption = await this._checkPermissions(option);
            const options = {
                camera: takePhoto,
                camera_roll: pickImage
            };
            const pickerResult = options[selectedOption] && (await options[selectedOption]());
            if (pickerResult && !pickerResult.cancelled) {
                if (pickerResult.width >= 600 || pickerResult.height >= 600) {
                    this.props.uploadImageSizeError();
                    this.setState({ imageSettingsOpen: true });
                } else {
                    this._openImageCropScreen(pickerResult);
                }
            }
        } catch (e) {
            //TODO: Do something if permission denied
        }
    };

Actually everything is perfect the only thing I want to know is that the returned object contains height and width. What are the units of that?

closed #4

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.