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

let pixelColor = get(x, y) breaks code #245

Open
somahargitai opened this issue Jun 27, 2023 · 0 comments
Open

let pixelColor = get(x, y) breaks code #245

somahargitai opened this issue Jun 27, 2023 · 0 comments

Comments

@somahargitai
Copy link

I am trying to save an SVG export by writing in the end of draw():

  if (mouseIsPressed && !isSvgSaved) {
    console.log("saving svg");
    save("mySVG.svg"); // give file name
    print("saved svg");
    isSvgSaved = true;
  }

This works very well simple elements, but now I try to save a project, where I use

let pixelColor = get(x, y) 

It breaks the code, I get this error:

index.html:172 Uncaught Error: svgcanvas: options.async must be set to true for getImageData
    at ImageUtils.getImageData (index.html:172:23)
    at Context.getImageData (index.html:1501:26)
    at d.default.Renderer2D._getPixel (p5.min.js:3:448164)
    at l.default.Renderer.get (p5.min.js:3:437733)
    at h.default.get (p5.min.js:3:573138)
    at draw (sketch.js:56:25)
    at o.default.redraw (p5.min.js:3:487659)
    at _draw (p5.min.js:3:424542)

I tried to solve it, even by copying your whole script into index.html and enforcing options.async = true everywhere, but neither worked.

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