callstack/react-native-image-editor

Output size of ImageEditor.cropImage become smaller

mingxin-yang opened this issue · 3 comments

Bug

Output size of ImageEditor.cropImage become smaller

Environment info

React native info output:

 // paste it here

Library version: 2.1.0

Steps To Reproduce

my code:

    const cropData = {
      offset: { x, y },
      size: { width, height },
      displaySize:{width,height},
      resizeMode: "cover"
    };
    RNFS.stat(this.props.imageUri).then((value)=>{
      console.warn("this.props.imageUri",value) // size is 2302015
    })
    console.warn("imageUri",this.props.imageUri,this.state.rotation);
    RNImageRotate.rotateImage(
      this.props.imageUri,
      this.state.rotation,
      rotatedUri => {
        ImageEditor.cropImage(
          this.props.imageUri,
          cropData,
          croppedUri => {
           RNFS.stat(croppedUri).then((value)=>{
                 console.warn("croppedUri",value) // size is 818649
            })
            this.props.onDone(croppedUri);
          },
          err => {
            console.log("cropping error");
            console.log(err);
          }
        );

      },
      err => {
        alert(err);
        console.log(err);
      }
    );

Describe what you expected to happen:

when the width and height is origin of the image, output size is 2302015

Reproducible sample code

try displaySize: {width * 4 ,height * 4}
It worked for me

I have tried various combination, one thing stood out to me is the cropped image quality is always degraded compared to the input ( which you can see clearly with your eyes)

3.1.0 releases include a new feature: number prop that lets you adjust the size of the picture. That should solve your issue