在使用cropper.js做裁剪是发现裁切的图片不够清晰,主要是由于canvas画图像素问题
解决方法:
把context = canvas.getContext('2d'),
改为 context = canvas.getContext('2d').translate(0.5,0.5),
即可
cropper.js代码位置
function getSourceCanvas(image, data) {
var canvas = $('<canvas>')[0],
context = canvas.getContext('2d').translate(0.5,0.5),
width = data.naturalWidth,
height = data.naturalHeight,
rotate = data.rotate,
rotated = getRotatedSizes({
width: width,
height: height,
degree: rotate
});