-
-
Save rsms/55292141a53c4b8b068912293c3dca76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let pixels = canvas.context2D().getImageData(0, 0, canvas.width, canvas.height).data | |
let pxcount = canvas.width * canvas.height | |
let stride = (pixels.length / pxcount) >>> 0 // bytes per pixel | |
let dominantColor = ( | |
stride != 4 ? [255,255,255,255] : | |
dominantColorRGBA(pixels, pxcount, stride * Math.max(1, scale)) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment