How to maintain image size when converting canvas to blob

When I do the following:


}, 'image/jpeg', 1);

Somehow the blob is downgraded to 300px*150px. How can I maintain the original size of the canvas image?


I got it!

By default, the width and height of canvas are 300px and 150px respectively.

I need to do the following:

<canvas width="640" height="480"></canvas>

Setting the dimensions with CSS won’t do.