React-native-image-crop-picker: Pathetic Image quality when picked from gallery

Created on 12 Sep 2018  ·  7Comments  ·  Source: ivpusic/react-native-image-crop-picker

The quality of image picked from gallery is very bad.

All 7 comments

the quality of image becomes ver bad after cropping , please tell the solution to it . I have a very big project using this repo , and i need to improve image quality asap

The problem is it tries to scale to the width and height of the CROP_WIDTH and CROP_HEIGHT.. I
I removed the Cropper, and set the setting to compressImageQuality: 0.8,

But i want the user to be able to crop the photo, if i will remove the cropper , the user won't be able to do so

@keshamtravels you can try this fork added a "square" option in the cropper, but this only gives you 1:1 cropped ratio.

Don't know what the proper solution is, but it worked when I used Picker and Cropper separately like so:

ImagePicker.openPicker(
// (..props)
).then((data) => {
ImagePicker.openCropper({
cropping: true,
path: data.path,
includeBase64: true,
width: data.width, // getting actual image width instead of the default which caused the quality issue
height: data.height, // getting actual image height instead of the default which caused the quality issue
freeStyleCropEnabled: true,
mediaType: 'photo',
}).then((data) => {
let a = data.data;
// (..use the image)
})
}).catch((err) => {
// alert(err)
});

不知道什么是正确的解决方案,但是当我像这样单独使用Picker和Cropper时它起作用了:

ImagePicker.openPicker(
//(.. props)
)。then ((data)=> {
ImagePicker.openCropper({
cropping:true,
path:data.path,includeBase64
:true,
width:data.width,// getting actual图像宽度而不是导致质量问题
高度的默认值:data.height,//获取实际图像高度而不是导致质量问题的默认值
freeStyleCropEnabled:true,
mediaType:'photo',
})。then((data) => {
let a = data.data;
//(.. use the image)
})
})。catch((err)=> {
// alert(err)
});

@saadkhwaja1 hi, can you share your complete code?

Was this page helpful?
0 / 5 - 0 ratings