对于抗锯齿,您需要设置重采样质量。
ctx.imageSmoothingQuality = "low|medium|high"
使用屏幕外的画布将图像缩小一半-
var c = document.createElement('canvas'), ocx = c.getContext('2d'); c.width = img.width * 0.5; c.height = img.height * 0.5; ocxx.drawImage(img, 0, 0, c.width, c.height);
//将图像再次缩小到一半并重复
ocx.drawImage(c, 0, 0, c.width * 0.5, cc.height * 0.5);