是否可以在不使用画布的情况下对图像进行像素化?
问题描述:
给出一个< img>
元素,是否可以仅使用CSS和/或不使用画布来像素化图像?我见过类似 crisp edges 功能(但这仅适用于缩放后的图像)之类的东西画布选项,但我希望有更好的方法.
Given an <img>
element, is it possible to pixelate the image using only CSS and/or not use canvas?
I've seen things like the crisp edges feature (but that's just for images that are scaled) and a lot of canvas options, but I'm hoping for a better way.
答
您可以通过使用 image-rendering:pixelated;
CSS规则并放大图像来实现像素化效果-请参阅本文.
You can achieve a pixelated affect by using the image-rendering: pixelated;
CSS rule and scaling up an image - see this article.