Socket
Socket
Sign inDemoInstall

dechroma

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dechroma

Chroma keying for canvas-manipulated video


Version published
Weekly downloads
5
increased by400%
Maintainers
1
Install size
19.9 kB
Created
Weekly downloads
 

Readme

Source

dechroma.js

NPM version NPM total downloads install size minified size

Chroma key compositing (e.g., green screen) for HTML canvas-manipulated video, using ImageData.

Install

$ npm i dechroma
# or
$ yarn add dechroma
# or
$ pnpm add dechroma

Example

import { dechroma } from 'dechroma';

...

const video = document.querySelector('video');
const c = document.querySelector('canvas');
const ctx = c.getContext('2d');

...

video.addEventListener('play', drawVideo);

function drawVideo() {
  ctx.drawImage(video, 0, 0, width, height);
  const frame = ctx.getImageData(0, 0, width, height);

  // Remove green screen
  dechroma(frame, [0, 100], [170, 255], [0, 110]);

  ctx.putImageData(frame, 0, 0);
  requestAnimationFrame(drawVideo);
}

License

Licensed under the MIT License.

Keywords

FAQs

Last updated on 27 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc