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

Cropping Image #166

Open
BernhardGoehmann opened this issue Sep 5, 2023 · 1 comment
Open

Cropping Image #166

BernhardGoehmann opened this issue Sep 5, 2023 · 1 comment

Comments

@BernhardGoehmann
Copy link

BernhardGoehmann commented Sep 5, 2023

If the crop prop is set to true, the uploaded image is cropped to fit the canvas size for the preview. However, the original, uncropped file is emitted with the Change event. Is this intended behaviour? Is there any good way to crop the actual file to the size of the canvas?

@alessiomaffeis
Copy link
Owner

Hi! Yes, that's the intended behaviour: the cropping is only for presentational purposes. If you want to get the cropped image, you need to access the underlying canvas element and use the toBlob or toDataURL methods.

If you wanna add that feature as a contribution, a PR would be welcome! :) I'd just add a cropFile boolean prop and emit a file based on canvas.toBlob instead of the original file if the prop is set to true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants