← Home ← Back to /g/

Thread 106314705

5 posts 2 images /g/
Anonymous No.106314705 >>106315033 >>106315069
working on a project
document.querySelectorAll('img').forEach(img => {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
canvas.width = img.width;
canvas.height = img.height;
ctx.drawImage(img, 0, 0);
const pixels = ctx.getImageData(0, 0, img.width, img.height).data;
let targetColorCount = 0;
const targetRGB = [104, 152, 76]; // #68984c in RGB
for (let i = 0; i < pixels.length; i += 4) {
const r = pixels[i], g = pixels[i+1], b = pixels[i+2];
if (Math.abs(r - targetRGB[0]) < 20 && Math.abs(g - targetRGB[1]) < 20 && Math.abs(b - targetRGB[2]) < 20) {
targetColorCount++;
}
}
if (targetColorCount / (pixels.length / 4) > 0.4) {
img.style.display = 'none';
}
});
Anonymous No.106315033 >>106318212
>>106314705 (OP)
this makes mustard gas doesn't it
Anonymous No.106315069
>>106314705 (OP)
The thing that I hate about JavaScript writers, is the not putting a bracket on a new line and lining them up. It's so ugly.
Anonymous No.106316147
reminder that sharty the hacker hacked 'chan and 'channers did nothing about it because they are only good at injecting estrogen, collecting stinkpads and arguing about which tranny distro is more transexual and consuming corporate sloppa
Anonymous No.106318212
>>106315033
https://www.colorhexa.com/68984c
It's a (simplistic) way to hide frog images on this Mongolian basket-weaving forum