Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image blur with CSS/Javascript: is it possible?

Tags:

Is it possible to add a blur effect to an image using CSS and Javascript?

like image 322
Olivier Lalonde Avatar asked Feb 22 '11 11:02

Olivier Lalonde


People also ask

Can you blur images in CSS?

For having a blurring effect use CSS filter property, which allows having effects like blur or color shifting on an element. The blur function of the filter property adds a Gaussian blur to the input image.

How do I blur part of an image in CSS?

So, here's how to create a background blur using the backdrop-filter CSS property. backdrop-filter: blur(5px); That's it.

How do you blur in Javascript?

The HTMLElement. blur() method removes keyboard focus from the current element.

How do you make something blurry in CSS?

The first way of creating a blurred text is making your text transparent and applying shadow to it. The shadow will make the text appear blurred. Use a <div> with an id "blur". Then, set the color property to its “transparent” value and define the text-shadow property to give a shadow to the text.


2 Answers

Yep, this works a treat:

Pixastic is an experimental library which allows you to perform a variety of operations on images using just a bit of JavaScript. The effects supported out of the box include desaturation/greyscale, invert, flipping, brightness/contrast adjustment, hue/saturation, emboss, blur, and many more...

Pixastic works by utilizing the HTML5 Canvas element which provides access to raw pixel data, thereby opening up for more advanced image effects. This is where the "experimental" part comes into play. Canvas is only supported by some browsers and unfortunately Internet Explorer is not one of them. It is however well supported in both Firefox and Opera and support for Safari only just arrived with the recent Safari 4 (beta) release. Chrome currently works in the dev channel. A few of the effects have been simulated in IE using the age old proprietary filters. While these filters are much faster than their Canvas friends, they are few and limited. Hopefully we will one day have real Canvas on IE as well...

like image 133
Barrie Reader Avatar answered Nov 10 '22 00:11

Barrie Reader


Alternatively you could use StackBlur or Superfast Blur

like image 38
Quasimondo Avatar answered Nov 09 '22 23:11

Quasimondo