http://sidneys77crlfslcr7zmj3msmxchgnxhrxlp3p3kbaswo7twchjnicid.onion/programming/tips/2024/12/02/html5-canvas-tips.html
To overcome this, we’ll
need to offset the coordinates of the line by half a pixel. Maybe an illustration will help: So, let’s apply these fixes: canvas { width : 300px ; height : 300px ; image-rendering : pixelated ; } // ... ctx . rect ( 5 .5 , 5 .5 , 40 , 40 ); // ...