Skip to content

Instantly share code, notes, and snippets.

@mariotacke
Created July 11, 2019 18:59
Show Gist options
  • Save mariotacke/9a8445fa4c95def6f3930a611ce3793d to your computer and use it in GitHub Desktop.
Save mariotacke/9a8445fa4c95def6f3930a611ce3793d to your computer and use it in GitHub Desktop.
for (let y = 0; y < height; y += fontHeight) {
for (let x = 0; x < width; x += fontWidth) {
const frameSection = hiddenContext.getImageData(x, y, fontWidth, fontHeight);
const { r, g, b } = getAverageRGB(frameSection);
outputContext.fillStyle = `rgb(${r},${g},${b})`;
outputContext.fillText('@', x, y);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment