and I add a debug found that after I set the size(width =512, height=1024), the canvas seems to add them as “style” but the master is “width” and “height”.
Pixel ratio is not related to aspect ratio, it’s for high-DPI displays or other resolution adjustments. You probably want it to be 1, window.devicePixelRatio, or somewhere in between.