lens-filter-grayscale
Small browser library to apply a grayscale transformation to a image relying on lens-core
handle the transformation and distribute work with webworkers.
Check out lens monorepo for other related modules
Install
npm install lens-filter-grayscale --save
Usage
It applies a grayscale transformation to a base64 image. If you want a more complete library, please check lens-chainable that wraps this and other libraries to provide a more complete suite of image filters.
This library consumes ImageData and outputs ImageData in a Promise. You can use lens-core
to convert from ImageData to dataURL.
JS file:
; ;
Frequent questions:
How can I get image data from a image tag?
const element = document;const canvas = document;const context = canvas;context;const imageData = context;
How can I get image data from url?
const element = document;element; const canvas = document;const context = canvas;context;const imageData = context;
How can I use the output of this?
;; ;