how to loadImage() from createImg()-p5.dom or from base64

Hi! I need some help with:

loadImage() from createImg()-p5.dom


loadImage() from a data URI, such as "data:image/jpg;base64,{base 64 encoded data block}"

The createImg() comes from an createFileInput(), and I want o be able to resize() that image.

Thanks for your help!

Code below:

function setup() {
    createFileInput (handleFile);
    createCanvas (800, 400);
    background (245);

function draw() {
    strokeWeight (10);
    stroke (0, 255,0);
    line (pmouseX, pmouseY, mouseX, mouseY);

function handleFile (file) {
  if (file.type === 'image') {
    var img = createImg (;
    print (img);

    //img.resize (width, 0);
    image (img, 0, 0);


Sign In or Register to comment.