Loading Images

ArtistAPhoto provides multiple ways to load images.

From URL

const editor = await ArtistAPhoto.fromUrl('https://example.com/image.jpg');

Note: the image URL must be CORS-enabled or same-origin.

From File Input

const fileInput = document.getElementById('fileInput');
fileInput.addEventListener('change', async (e) => {
  const file = e.target.files[0];
  const editor = await ArtistAPhoto.fromFile(file);
});

From Canvas Element

const canvas = document.getElementById('myCanvas');
const editor = await ArtistAPhoto.fromCanvas(canvas);

From Image Element

const img = document.getElementById('myImage');
const editor = await ArtistAPhoto.fromImageElement(img);