Skip to content
This repository has been archived by the owner on May 31, 2023. It is now read-only.

Correct way to use cropImage #75

Open
ricardonior29 opened this issue Nov 11, 2020 · 2 comments
Open

Correct way to use cropImage #75

ricardonior29 opened this issue Nov 11, 2020 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@ricardonior29
Copy link

Can someone explain to me how to use the cropImage function please..

<< FlutterNativeImage.cropImage(file.path, originX, originY, width, height); >>
What means originX, originY, what if with>height... things like that.

Constantly i get this error: java.lang.IllegalArgumentException: x + width must be <= bitmap.width()
Thanks.

@ricardonior29 ricardonior29 changed the title Correct way to crop Correct way to use cropImage Nov 11, 2020
@btastic
Copy link
Owner

btastic commented Apr 7, 2021

@a-leblond did this feature. Can you maybe tell him, what he is doing wrong?

@btastic btastic added the help wanted Extra attention is needed label Apr 7, 2021
@a-leblond
Copy link
Contributor

a-leblond commented Apr 7, 2021

Hi,

If i remember correctly originX, originY are the coordinates of the top left corner where you want your cropped image to start, and width and height the desired size of the cropped image.

So if you have an image 120px width and 100px height, and you want to crop a square of 100px taking full height but centered horizontally, it should be originX = 10, originY = 0, height = 100, width = 100. This will crop a square, removing 10px at the start of the image and 10px at the end.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants