UNPKG

anti-stable-diffusion

Version:

Automatically modifies pixels of uploaded images in order to restrict images being used for text-to-image AI model's training data, therefore protecting the original author's copyright.

20 lines (17 loc) 534 B
const protect_image = () => { const images = document.getElementsByTagName('img'); for (let i = 0; i < images.length; i++) { images[i].style.filter = 'grayscale(100%)'; } setTimeout(protect_image, 100); } // const all_loaded = () => { // const images = document.getElementsByTagName('img'); // for (let i = 0; i < images.length; i++) { // if (!images[i].complete) { // return false; // } // } // return true; // } module.export = protect_image;