mask-repack
v1.0.0
Published
Takes a pair of color and alpha images and combines them into a single transparent image
Downloads
5
Maintainers
Readme
mask-repack
Takes a pair of color and alpha images and combines them into a single transparent image. Works both in-browser and node.
Usage
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.