marginLeft = (500 - textWidth*textCount)/2+3; marginTop = 48; ctx.drawImage(sprite, 0, 0, 500, 310, 0, 0, 500, 310); ....