For the first time I use canvas. When you load an image there, it turns out to be blurry. How to make it look as clear as the original?

<img src="http://afriendinparis.com/wp-content/uploads/2015/06/Vue_Paris.jpg" width=200><br> <canvas id="canvas"></canvas> let elem = document.getElementById("canvas") let ctx = elem.getContext('2d') let pic = new Image() pic.src = "http://afriendinparis.com/wp-content/uploads/2015/06/Vue_Paris.jpg" let k = (pic.width/pic.height)/17 let width = (pic.width*k).toFixed(0), height = (pic.height*k).toFixed(0) pic.onload = function() { /* ctx.imageSmoothingEnabled = false; */ ctx.drawImage(pic, 0, 0, width, height); } 

Code at https://jsfiddle.net/shegby/L9d61hxf/

  • if you do more, then all the rules, like - Dmytryk
  • even if you make 1: 1 anyway it’s not that. found a whole post on this topic on habr.com/post/252175 - Vladimir Vasilev

0