I am experiencing an error creating a new Raster object when using a DOM image as the source.
I've noticed that instantiating a Raster in different ways produces different results however:
const domImg = new window.Image(100, 100);
domImg.src = 'http://paperjs.org/about/paper-js.gif';
const ok = new paper.Raster(domImg);
const fails = new paper.Raster({source: domImg});
If I define an onError(error) function on the latter case, I get:
JSON.stringify(error) // "{"event":{"isTrusted":true},"type":"error"}"
error.event.target // <img src=​"[object HTMLImageElement]​">​
UPDATE: This seems to be a problem with setting Raster.source using a DOM Image.
See Sketch: instead of seeing three Raster images, only one succeeds.

Image should load in both cases from DOM as specified in the documentation.
paper 0.12.0, node v8.12.0, Ubuntu 16.04.5 LTS, Chrome Version 72
Hi, thank you for the report.
As a workaround, waiting for a correction, you can use raster.image property instead.
See this sketch for a demonstration.
new Raster({
image: domImg
});
var raster= new Raster();
raster.image = domImg;
About what we should do, I see 2 possibilities:
@lehni, what do you think ?
Yes, the documentation is wrong here. Raster#source is only expected to be a string, and can either be a URL or a data URL. Raster#image accepts a DOM image or a canvas object. I'll change the documentation.
BTW, the constructor itself supports both versions: new Raster(image) and new Raster(source)
Most helpful comment
Yes, the documentation is wrong here.
Raster#sourceis only expected to be a string, and can either be a URL or a data URL.Raster#imageaccepts a DOM image or a canvas object. I'll change the documentation.