Home > Back-end >  Can I increase HTML5 canvas resolution?
Can I increase HTML5 canvas resolution?

Time:10-13

Html canvas decreases the resolution of images and shapes. Is there a way by which we can increase the quality?

CodePudding user response:

Sure:

const width = ..., height = ..., scale = 2;
const canvas = document.querySelector('...')
canvas.style.width = width;
canvas.style.height = height;
canvas.width = width * scale;
canvas.height = height * scale;
  • Related