How to double the pixel size of a canvas?

canvas, css, html, javascript, scale

Solution

You can adjust the resolution with the height and width properties, while adjusting the size's display trough the style.

<canvas width="320" height="200" style="width:640px;height:400px;"></canvas>

Problem

I have a canvas of the size 320*200 pixels. Now I want to double the size of the pixels, resulting in a 640*400 display. I don't want it to have a higher pixel resolution, just everything doubled (bigger visible pixels). Any idea on how to do that?

Original source