简体   繁体   English

如何在不支持 CSS3 过滤器的浏览器中模糊图像

[英]How to blur image in browsers that don't support CSS3 filters

Having a blurred image is one of the main aesthetic features on my website.图像模糊是我网站上的主要美学特征之一。 So far I am using CSS3 filter blur() to create the blur, but I know this is not supported in neither Firefox nor Internet Explorer.到目前为止,我使用 CSS3 filter blur() 来创建模糊,但我知道 Firefox 和 Internet Explorer 都不支持。 I was wondering is there an alternative, maybe JavaScript/jQuery, which will help me create the blurred effect I am looking for?我想知道有没有替代方案,也许是 JavaScript/jQuery,它可以帮助我创建我正在寻找的模糊效果?

See if blur.js , a jQuery plugin, does the trick for you.看看blur.js (一个 jQuery 插件)是否适合你。 Essentially, what it does is move your image to a <canvas> , and does the blurring effects there.本质上,它所做的是将您的图像移动到<canvas> ,并在那里进行模糊效果。 See a more comprehensive article on the topic: Effects for the Web!请参阅有关该主题的更全面的文章: Web 效果! . .

That's possible using javascript. 使用javascript可以实现。 Check out this one: http://www.blurjs.com 看看这个: http : //www.blurjs.com

Another awesome script is vague: https://github.com/GianlucaGuarini/vague.js for an example, have a look here: http://codepen.io/GianlucaGuarini/pen/Hzrhf 另一个很棒的脚本是模糊的:例如, https//github.com/GianlucaGuarini/vague.js ,请看这里: http : //codepen.io/GianlucaGuarini/pen/Hzrhf

There are plenty of JS libraries that blur images.有很多 JS 库可以模糊图像。

Anyway, if you're using a static blurred image (ie, no need to unblur/blur it again), I'd say you should go with a normal bitmap image.无论如何,如果您使用静态模糊图像(即,无需再次取消模糊/模糊),我会说您应该使用普通位图图像。 That might help to avoid unnecessary CPU load on the browser and compatibility issues.这可能有助于避免浏览器上不必要的 CPU 负载和兼容性问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM