Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Identify images that are displayed wider than their natural width (which results in them looking blurry)
  1. Paste this into your browser console.
  2. Start resizing the window.
  3. Any images that are ever displayed in a blurry fashion will throw an error and get faded out to 0.05 opacity.
window.addEventListener('resize', () => {
Array.from(document.querySelectorAll('img')).forEach(img => {
if ((img.clientWidth * window.devicePixelRatio) > img.naturalWidth) {
console.error(img);
img.style.opacity = '0.05';
} else {
img.style.opacity = '1';
}
});
});
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.