HTML5 - Canvas, drawImage() draws image blurry

后端 未结 6 1506
[愿得一人]
[愿得一人] 2020-12-15 20:29

I am trying to draw the following image to a canvas but it appears blurry despite defining the size of the canvas. As you can see below, the image is crisp and clear whereas

6条回答
  •  佛祖请我去吃肉
    2020-12-15 20:48

    In addition to @canvas answer.

    context.imageSmoothingEnabled = false;
    

    Works perfect. But in my case changing size of canvas resetting this property back to true.

    window.addEventListener('resize', function(e){
        context.imageSmoothingEnabled = false;
    }, false)
    

提交回复
热议问题