I recognize that Canvas drawImage is inexplicably offset by 1 Pixel is a very similar issue, but I was already applying the advice given in that question\'s answer before I
I can't tell for IE, but at least for Safari, this sounds like a bug in their nearest-neighbor algorithm when the transformation matrix translate is set to exactly n.5
.
onload = function() {
var ctx = document.querySelector('canvas').getContext('2d');
ctx.imageSmoothingEnabled = false;
var img = document.querySelector('#hero');
ctx.setTransform(2, 0, 0, 2, 99.49, 99.49);
ctx.drawImage(img, 32, 32, 16, 16, 0, 0, 16, 16);
ctx.setTransform(2, 0, 0, 2, 99.5, 99.5);
ctx.drawImage(img, 32, 32, 16, 16, 16, 0, 16, 16);
ctx.setTransform(2, 0, 0, 2, 99.51, 99.51);
ctx.drawImage(img, 32, 32, 16, 16, 32, 0, 16, 16);
};
Result in Safari 11.0.3
You may want to let them know about it from their bug-tracker.
The workaround would be to make sure that you never lay on floating coordinates, even in your transformation matrix.