Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

208
Views
Why the image in my paint app isn't showing on the screen?
select("#loadButton").mouseClicked(function(){
  var file = this.files[0];
  file.src = URL.createObjectURL(this.files[0]);
  loadImage(file.src, img => {
      image(img, 0,0);
  });
});

I'm building a paint app using p5.js and I'm trying to upload an image file but it doesn’t show on the screen.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to setup a file input and handler. After that, you need to write the image to the canvas. The following was copied directly from the p5.js website:

let input;
let img;

function setup() {
  input = createFileInput(handleFile);
  input.position(0, 0);
}

function draw() {
  background(255);
  if (img) {
    image(img, 0, 0, width, height);
  }
}

function handleFile(file) {
  print(file);
  if (file.type === 'image') {
    img = createImg(file.data, '');
    img.hide();
  } else {
    img = null;
  }
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!