Docs
API Docs

Changing the current Image

You can change the currently loaded image with the setImage function.

Make sure that your image has finished loading before you pass it to the editor. This also applies when creating the editor for the first time.

The following example assumes that the editor has already been initialized and assigned to the editor variable.

var image = new Image()
image.onload = function () {
    editor.setImage(image)
}
// image.crossOrigin = 'Anonymous'  // Setup CORS accordingly if needed
image.src = '...'
var image = new Image()
image.onload = function () {
    editor.setImage(image)
}
// image.crossOrigin = 'Anonymous'  // Setup CORS accordingly if needed
image.src = '...'