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

148
Views
save image automatically with javascript

I have a script that crops an image from the video stream.

    let ctx = image.getContext("2d");
    ctx.drawImage(results.image, croprect.x, croprect.y, croprectwidth, croprectheight, 0, 0, 300, 200);

In HTML

      <div id="image-div">
            <canvas id="image" width="300" height="200"></canvas>                
      </div> 

Now I need to do some image processing manipulation with it. I do 'Save as' for the test but how to do it automatically?

I tried

    const canvas = document.getElementById('image');
    const dataURL = canvas.toDataURL();
    console.log(dataURL); 

In the console, it gives an URL but when I open it, it is just a blank (white) rectangle (correct size 300x200) I want to save it to my local folder and to the backend later when the second step (image processing) of the script will work.

about 4 years ago · Juan Pablo Isaza
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!