Description
Implementation of various algorithms that transform colourful images to black and white.
Install
npm i wasm-image-to-black-white --save
Algorithms
Original Image
Averaging Color Channels
Gray = (Red + Green + Blue) / 3
const wasm = import"wasm-image-to-black-white";wasm;
Luminocity
Gray = (Red * 0.21 + Green * 0.72 + Blue * 0.07)
const wasm = import"wasm-image-to-black-white";wasm;
Desaturation
Gray = ( Max(Red, Green, Blue) + Min(Red, Green, Blue) ) / 2)
const wasm = import"wasm-image-to-black-white";wasm;
BT601
Gray = (Red * 0.299 + Green * 0.587 + Blue * 0.114)
const wasm = import"wasm-image-to-black-white";wasm;
Example
const wasm = import"wasm-image-to-black-white"; const fileUploader = document; fileUploader