mask-repack

1.0.0 • Public • Published

mask-repack

stable

Takes a pair of color and alpha images and combines them into a single transparent image. Works both in-browser and node.

Usage

NPM

combined = repack(color, alpha)

Takes color and alpha, two images encoded as ndarrays, and returns a single combined ndarray image.

For example, you can combine this with mask-unpack in a preprocessing step to get transparent images encoded with JPG instead of PNG, potentially saving on page weight for certain images.

const Texture = require('gl-texture2d')
const repack = require('mask-repack')
const load = require('get-pixels')
 
load('image-color.jpg', function (err, color) {
  load('image-alpha.jpg', function (err, alpha) {
    const data = repack(color, alpha)
    const texture = Texture(gl, data)
  })
})

See Also

License

MIT, see LICENSE.md for details.

Package Sidebar

Install

npm i mask-repack

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • hughsk