- Canvas implements image filter function
$ npm install filter-images
// import package
import filterImages from 'filter-images'
// Basic usage
filterImages.filter(type, element, img)
// Successful callback
filterImages.filter(type, element, img).then(() => {})
// Failure callback
filterImages.filter(type, element, img).catch(() => {})
-
Type
Specify a filter name
type | Example | description |
---|---|---|
null/false/0/undefined | filter(false, element, img) | Copy images to Canvas |
baw | filter('baw', element, img) | Black and white filter |
mirror | filter('mirror', element, img) | mirror filter |
sculpture | filter('sculpture', element, img) | sculpture filter |
invert | filter('invert, element, img) | Inverted filter |
gray | filter('gray', element, img) | gray filter |
blur | filter('blur', element, img) | blur filter |
relief | filter('relief', element, img) | Embossing filter |
-
Element
Pass in a parent element to hold the generated canvas
-
Img
Image to be processed