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

Android cropImage Error #41

Open
cagataykula opened this issue Apr 16, 2021 · 3 comments
Open

Android cropImage Error #41

cagataykula opened this issue Apr 16, 2021 · 3 comments

Comments

@cagataykula
Copy link

Screen Shot 2021-04-17 at 01 51 27

Hi everyone. I'm getting an error about cropping image.
Error: y + height must be <= bitmap.height() at Object.promiseMethodWrapper [as cropImage] (NativeModules.js:103) at Function.cropImage (ImageEditor.js:63) at ImageCropper.js:208 at tryCallTwo (core.js:45) at doResolve (core.js:200) at new Promise (core.js:66) at Function.ImageCropper.crop (ImageCropper.js:207) at handlePress$ (VM5 BackgroundOptionView.bundle:96) at tryCatch (runtime.js:63) at Generator.invoke [as _invoke] (runtime.js:293)

Device: Xiaomi Mi 9T (Redmi K20)
Android Version: 10 QKQ1.190825.002

Is someone faced with this issue ? I'm waiting your helps, thanks :)

@SSinfo302
Copy link

same issue but i found that its only for landscape image.

@eng-naveed
Copy link

Same Issue

@jsdaniell
Copy link

jsdaniell commented Dec 6, 2023

Add this logic on your crop configurations:

Case of landscape, height must be width and width must be height.

const imageIsLandScape = width > height;

if (!imageIsLandScape) {
        cropData = {
          offset: {x: 0, y: 0},
          size: {width: width, height: height},
          displaySize: {width: newWidth, height: newHeight},
          resizeMode: 'contain'
        };
      } else {
        cropData = {
          offset: {x: 0, y: 0},
          size: {width: height, height: width},
          displaySize: {width: newHeight, height: newWidth},
          resizeMode: 'contain'
     };
 }

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

4 participants