หากต้องการวางรูปภาพขนาดเรตินาลงในแคนวาส HTML5 ให้ลองใช้โค้ดต่อไปนี้กับแคนวาส:
var context = myCanvas.getContext("2d");
context.attr("width", width * window.devicePixelRatio);
context.attr("height", height * window.devicePixelRatio);
context.scale(window.devicePixelRatio, window.devicePixelRatio);
context.drawImage(img, x, y, width, height);