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
interesting... I ran into this issue the other day and agree it would be nice. let's start tagging all DOM related ideas with the "dom" tag so if we have tackle this with GSoC or at CMU we can find them easily.
Wondering if this is still a relevant fix worth looking into since loading images from url to canvas is possible when not using p5! (which is always a bummer!)
This stack overflow thread has the following example of how it can be achieved.
var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); var img = new Image(); img.onload = function() { ctx.drawImage(img, 0, 0); }; img.src = 'https://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png';
Activity
lmccart commentedon Apr 9, 2015
interesting... I ran into this issue the other day and agree it would be nice. let's start tagging all DOM related ideas with the "dom" tag so if we have tackle this with GSoC or at CMU we can find them easily.
fixes processing#561, adds callback fxn to createImg()
eliawk commentedon Oct 16, 2016
Hello,
i'm using createImg to load an external image and then i'd like to use the p5.Image method (get, filter,...) but i get a p5.Element instead.
if i try to force the element to be an image
cover = new p5.Image(cover_load.width,cover_load.height,cover_load);
i get this error:
p5.js:14593 Uncaught IndexSizeError: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source width is 0.
where am i wrong?
thnaks
E
Chrome blocks image loading because of CORS security
julsgud commentedon Apr 9, 2017
Hey All!
Wondering if this is still a relevant fix worth looking into since loading images from url to canvas is possible when not using p5! (which is always a bummer!)
This stack overflow thread has the following example of how it can be achieved.
var c = document.getElementById("myCanvas");var ctx = c.getContext("2d");var img = new Image();img.onload = function() { ctx.drawImage(img, 0, 0); };img.src = 'https://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png';Thoughts?
Happy sketching :)
andreiverse commentedon May 7, 2018
I love when I am looking for CanvasJS and I see this