Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output size of ImageEditor.cropImage become smaller #45

Closed
mingxin-yang opened this issue Nov 5, 2019 · 4 comments
Closed

Output size of ImageEditor.cropImage become smaller #45

mingxin-yang opened this issue Nov 5, 2019 · 4 comments

Comments

@mingxin-yang
Copy link

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

@linhmimoza
Copy link

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

@s123121
Copy link

s123121 commented Apr 26, 2020

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)

@retyui
Copy link
Collaborator

retyui commented Feb 3, 2024

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

@retyui retyui closed this as completed Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@s123121 @retyui @mingxin-yang @linhmimoza and others