Skip to main content
You're viewing documentation for a previous version of this software.Switch to the latest stable version
PESDK/Web

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.

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