• Stars
    star
    1,242
  • Rank 36,455 (Top 0.8 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 10 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fast and almost Gaussian blur

StackBlur.js

NPM Version License

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

Original source:

Getting Started

Standalone version

To use the standalone version,

download the latest zip from Github or clone the repository

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

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

<script src="StackBlur/dist/stackblur.js"></script>

Node

To use the NPM package,

install the package:

npm install --save stackblur-canvas

and require it where needed

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

Browsers

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

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:

import * as StackBlur from 'stackblur-canvas';

API

See also the docs in docs/jsdoc.

Image as source:

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:

StackBlur.canvasRGBA(targetCanvas, top_x, top_y, width, height, radius);
  • targetCanvas: the HTMLCanvasElement.
  • top_x: the horizontal coordinate of the top-left corner of the rectangle to blur.
  • top_y: 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:

StackBlur.canvasRGB(targetCanvas, top_x, top_y, width, height, radius);
  • targetCanvas: the HTMLCanvasElement.
  • top_x: the horizontal coordinate of the top-left corner of the rectangle to blur.
  • top_y: 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:

StackBlur.imageDataRGBA(imageData, top_x, top_y, width, height, radius);
  • imageData: the canvas' ImageData.
  • top_x: the horizontal coordinate of the top-left corner of the rectangle to blur.
  • top_y: 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:

StackBlur.imageDataRGB(imageData, top_x, top_y, width, height, radius);
  • imageData: the canvas' ImageData.
  • top_x: the horizontal coordinate of the top-left corner of the rectangle to blur.
  • top_y: 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

More Repositories

1

p0wny-shell

Single-file PHP shell
PHP
1,894
star
2

rivalcfg

CLI tool and Python library to configure SteelSeries gaming mice
Python
737
star
3

nautilus-terminal

A terminal embedded in Nautilus, the GNOME's file browser
Python
310
star
4

yoga-image-optimizer

A graphical tool to convert and optimize JPEG, PNG and WebP images (based on YOGA)
Python
132
star
5

gameboy-examples

Example programs that run on the Nintendo GameBoy
C
79
star
6

cover-thumbnailer

Generates folder thumbnails for various file browser on Linux to display music album covers, preview of pictures which are in a folder and more.
Python
72
star
7

threadify

Simply transforms a javascript function into a web worker
JavaScript
62
star
8

evoland.gb

A fan-made demake of Evoland on GameBoy
C
37
star
9

pypapi

Python binding for the PAPI (Performance Application Programming Interface) library
Python
36
star
10

img2gb

Converts images to GameBoy tiles
Python
32
star
11

stone.js

gettext-like client-side Javascript Internationalization Library
JavaScript
23
star
12

asus-keyboard-backlight

Configure the keyboard backlight on ASUS laptops.
Python
16
star
13

calcleaner

A simple graphical tool to purge old events from CalDAV calendars
Python
16
star
14

stonejs-tools

Tools for extracting/compiling translatable strings from javascript source
JavaScript
12
star
15

pavage

Lightweight library to arrange HTML elements in a Waterfall / Pinterest-like column layout
JavaScript
12
star
16

twitch-api-examples

Examples that use Twitch APIs to display notifications in OBS
JavaScript
7
star
17

shmined

The minesweeper game, in Bash!
Shell
5
star
18

tern-abitbol

Tern.js plugin to autocomplete Abitbol classes
JavaScript
4
star
19

maptosym

Generates no$gmb symbole files (.sym) from GBDK and SDCC / ASxxxx map files (.map)
Python
4
star
20

rst2gemtext

Converts reStructuredText to Gemtext (Gemini markup format)
Python
4
star
21

suorafxctl

Configure Roccat Suora FX keyboards on Linux
Python
4
star
22

grunt-stonejs-tools

Stone.js Grunt plugin to extract / compile translatable strings
JavaScript
3
star
23

pipe.js

Simply queue asynchrone jobs in javascript.
JavaScript
3
star
24

simple-screencast

Simple screen recording application for GNOME Shell
Python
3
star
25

webassembly-examples

Example WebAssembly programs
HTML
3
star
26

KeyboardJS

This is a fork of an old KeyboardJS version that is required by some old projects... DO NOT USE ON NEW PROJECTS...
JavaScript
3
star
27

vim-color-picker

A GTK 2 color picker for VIM
Vim Script
2
star
28

tdct-live-irc-bot

An IRC bot to follow the TdCT on ##tdct-live (irc.freenode.net)
JavaScript
2
star
29

tetrize

A Tetris-like game in Java
Java
2
star
30

damn-monkey

A Donkey Kong-like game
C
2
star
31

hangman8086

An implementation of the Hang Man game in assembly (Emu8086)
Assembly
2
star
32

yoga-image-benchmark

Python
1
star
33

.vim

My VIM config
Vim Script
1
star