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

358
Views
BadQuality/Blurry image html2canvas

I am starting with the JS library html2canvas to create a screenshot from a div. The problem is that my screenshot is not qualitative and is blurry.

How can I improvemy code in order to have the best possible quality ?

I tried several methods (adding a scale,a dpi, etc) none worked.

var screenshot = document.getElementById("screenshotButton");

screenshot.addEventListener("click", function(event) {
  const captureElement = document.getElementById('main-frame')
  var instance = cy.contextMenus(contextMenuOptions); 
  instance.destroy()

  html2canvas(captureElement)
  .then(canvas => {
   //scale =2,
   // dpi = 400,
    crossOriginIsolated = 'anonymous',
    useCORS= true,
    foreignObjectRendering= true,
    allowTaint =false,
    canvas.style.display = 'none'
    document.body.appendChild(canvas)
    return canvas
  })
  .then(canvas => {
    const image = canvas.toDataURL('image/jpeg').replace('image/jpeg', 'image/octet-stream')
    const a = document.createElement('a')
    a.setAttribute('download', inputNodesParam + '.jpeg')
    a.setAttribute('href', image)
    a.click()
    canvas.remove()
  })
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!