You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a canvas with createCanvas() and, optionally, an offscreen canvas with createGraphics().
Call image() with a canvas as the main parameter.
The canvas is drawn correctly as an image, but it still logs a friendly error: "p5.js says: Expected Image or Element or Texture or Framebuffer or FramebufferTexture at the first parameter in image()."
Doing the above with image() attached to an offscreen canvas doesn't log errors.
Snippet:
letdefaultCanvas,graphicsCanvas;asyncfunctionsetup(){defaultCanvas=createCanvas(400,400);graphicsCanvas=createGraphics(400,400);graphicsCanvas.background(0);// doesn't affect results, but shows that the image() function still worksimage(defaultCanvas,0,0);// consoles errorimage(graphicsCanvas,0,0);// consoles errorgraphicsCanvas.image(defaultCanvas,0,0);// doesn't console errorgraphicsCanvas.image(graphicsCanvas,0,0);// doesn't console error}
The text was updated successfully, but these errors were encountered:
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you!
Most appropriate sub-area of p5.js?
p5.js version
p5.js v2.0.0-beta.2 February 3, 2025
Web browser and version
Chrome 133.0.6943.141 (Official Build) (64-bit) (cohort: M133 Rollout), Firefox 135.0.1 20250216192613
Operating system
Windows 10
Steps to reproduce this
Steps:
Doing the above with image() attached to an offscreen canvas doesn't log errors.
Snippet:
The text was updated successfully, but these errors were encountered: