Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// input (x, y)
const weights = [
[1, 4, 16, 4, 1],
[4, 16, 24, 16, 4],
[16, 24, 36, 24, 16],
[4, 16, 24, 16, 4],
[1, 4, 16, 4, 1],
];
let blur = 0;
let totalWeight = 0;
for (let i = 0; i < 5; i++) {
for (let j = 0; j < 5; j++) {
const weight = weights[i][j];
totalWeight += weight;
blur += weight * getPixelColor(x + i - 2, y + j -2);
}
}
blur /= totalWeight;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.