0.0.8 • Published 6 years ago

@cvsfun/mask v0.0.8

Weekly downloads
6
License
ISC
Repository
-
Last release
6 years ago

Mask

Do mask compositing processes with image mask or aphla matte.

install

$ yarn add @cvsfun/mask
# or
$ npm install --save @cvsfun/mask

Usage

import Mask from '@cvsfun/mask'
...
let compositeData = Mask.compositeImageMask(image, maskImage);
ctx.putImageData(compositeData, 0, 0);
...

image-mask

import Mask from '@cvsfun/mask'
...
// Alpha channel data from alpha matte:
// matte: [0, 0, 0, ... , 255, 240, 233, ... , 0] 
let compositeData = Mask.compositeAlphaMatte(image, matte);
ctx.putImageData(compositeData, 0, 0);
...

alpha-matte

Use

API

compositeImageMask(srcImage, imageMask)

compositeAlphaMatte(srcImage, alphaMatte)

Concept

  • alpha channel: Technically refers to the fourth (A) channel in an RGBA image file.
  • alpha matte: Value range is 0,1(100% opaque),the result of separating the foreground and background. Usually a grayscale image, contains every pixel's alpha value.
  • mask: Only has two values: 0 and 1, means opacity or opaque respectively.
0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.2

6 years ago