4

How can I blur the contents of an HTML5 canvas?

I know that I can use CSS, but I need to blur the contents of the canvas so that I can manipulate it later.

starbeamrainbowlabs
  • 5,692
  • 8
  • 42
  • 73

1 Answers1

4

There is no native function to do that. But you can implement your own image filter operations by using context.getImageData to get an array of raw RGBA values of the canvas data, do your filter operation on that data, and then write it back with context.putImageData.

http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#pixel-manipulation

Philipp
  • 67,764
  • 9
  • 118
  • 153