I have canvas which is width="600px" and height="500px".
then I show the image(1200px and 1000px) on this canvas
ctx.drawImage(img,600,500);
finally export with this script.
var a = document.createElement('a');
a.href = mycanvas.current.toDataURL('image/jpeg', 0.85);
In this case jpg’s final resolution is 600px x 500px.
However I want to keep final resolution 1200 x 1000 jpg.
What is the best practice for this purpose.
2
Answers
I use
clientWidth
andwidth
use
clientWidth = 600
andwidth = 1200
It can be done.
You can follow these steps to keep your final resolution as 1200 x 1000 px.