Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

StackBlur

> 编程语言
Open source

Fast and almost Gaussian blur

1.3K stars0 likes2 views
WebsiteGitHub

About

Fast and almost Gaussian blur

StackBlur.js

StackBlur.js is a fast, almost Gaussian blur created by Mario Klingemann.

  • More informations:
  • Algorithm:
  • Demo:

Original source:

Getting Started

Standalone version

To use the standalone version,

download the latest zip from Github or clone the repository

bash
git clone [email protected]:flozz/StackBlur.git

and include the dist/stackblur.js or dist/stackblur.min.js file in your HTML page:

xml

Node

To use the NPM package,

install the package:

bash
npm install --save stackblur-canvas

and require it where needed

javascript
const StackBlur = require('stackblur-canvas');

Browsers

If you are only supporting modern browsers, you may use ES6 Modules directly:

javascript
import * as StackBlur from
  './node_modules/stackblur-canvas/dist/stackblur-es.min.js';

Or, if you are using Rollup in your own project, use the node-resolve plugin, and import by just referencing the module:

javascript
import * as StackBlur from 'stackblur-canvas';

API

See also the docs in docs/jsdoc.

Image as source:

javascript
StackBlur.image(sourceImage, targetCanvas, radius, blurAlphaChannel);
  • sourceImage: the HTMLImageElement or its id.
  • targetCanvas: the HTMLCanvasElement or its id.
  • radius: the radius of the blur.
  • blurAlphaChannel: Set it to true if you want to blur a RGBA image (optional, default = false)

RGBA Canvas as source:

javascript
StackBlur.canvasRGBA(targetCanvas, topX, topY, width, height, radius);
  • targetCanvas: the HTMLCanvasElement.
  • topX: the horizontal coordinate of the top-left corner of the rectangle to blur.
  • topY: the vertical coordinate of the top-left corner of the rectangle to blur.
  • width: the width of the rectangle to blur.
  • height: the height of the rectangle to blur.
  • radius: the radius of the blur.

RGB Canvas as source:

javascript
StackBlur.canvasRGB(targetCanvas, topX, topY, width, height, radius);
  • targetCanvas: the HTMLCanvasElement.
  • topX: the horizontal coordinate of the top-left corner of the rectangle to blur.
  • topY: the vertical coordinate of the top-left corner of the rectangle to blur.
  • width: the width of the rectangle to blur.
  • height: the height of the rectangle to blur.
  • radius: the radius of the blur.

RGBA ImageData as source:

javascript
StackBlur.imageDataRGBA(imageData, topX, topY, width, height, radius);
  • imageData: the canvas' ImageData.
  • topX: the horizontal coordinate of the top-left corner of the rectangle to blur.
  • topY: the vertical coordinate of the top-left corner of the rectangle to blur.
  • width: the width of the rectangle to blur.
  • height: the height of the rectangle to blur.
  • radius: the radius of the blur.

RGB ImageData as source:

javascript
StackBlur.imageDataRGB(imageData, topX, topY, width, height, radius);
  • imageData: the canvas' ImageData.
  • topX: the horizontal coordinate of the top-left corner of the rectangle to blur.
  • topY: the vertical coordinate of the top-left corner of the rectangle to blur.
  • width: the width of the rectangle to blur.
  • height: the height of the rectangle to blur.
  • radius: the radius of the blur.

Hacking

Building

This library is built using Rollup. If you change something in the src/ folder, use the following command to re-build the files in the dist/ folder:

npm run rollup

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

JavaScript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言