Using OffscreenCanvas in a script


I’m trying to do an automation for a project of mine where it takes two images, overlays one over the other, and then saves the result to a new field.

I have tried to use OffscreenCanvas as well as a simple Image object. However, I get a cannot find name error for both. I am aware of the limitation on the DOM API, but both of the APIs are not a part of the DOM API.

Any ideas why I get this error? Or maybe an idea for a different solution?