Foliotek / Croppie

A Javascript Image Cropper
http://foliotek.github.io/Croppie
MIT License
2.56k stars 885 forks source link

I'm suggesting this code. #721

Open webee0317 opened 4 years ago

webee0317 commented 4 years ago

The pixel breaks when you reduce the large image to a smaller size. That's why I'm suggesting this code.

function _getCanvas(data) { ... ctx.imageSmoothingQuality = 'high'; ctx.drawImage(this.elements.preview, left, top, width, height, startX, startY, canvasWidth, canvasHeight); if (circle) { ctx.fillStyle = '#fff'; ctx.globalCompositeOperation = 'destination-in'; ctx.beginPath(); ctx.arc(canvas.width / 2, canvas.height / 2, canvas.width / 2, 0, Math.PI * 2, true); ctx.closePath(); ctx.fill(); } return canvas; }