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

willReadFrequently on getResult() canvas ? #287

Open
Dylan190774 opened this issue Sep 21, 2024 · 1 comment
Open

willReadFrequently on getResult() canvas ? #287

Dylan190774 opened this issue Sep 21, 2024 · 1 comment

Comments

@Dylan190774
Copy link

Dylan190774 commented Sep 21, 2024

In devtools console I get the following warning:

Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true. See: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently

This happens when I use const result = this.$refs.cropper.getResult(); a few times after another and then do getImageData on the context of result.canvas

Any idea how to set willReadFrequently on the canvas of getResult ?

@Dylan190774
Copy link
Author

Found the solution, I just had to use :

const ctx = canvas.getContext('2d', { willReadFrequently: true });
when getting the context of the canvas.

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

1 participant