JSPM

ndarray-bitmap-to-rgba

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q39157F
  • License MIT

expand 1-channel bitmaps into rgba pixmaps

Package Exports

  • ndarray-bitmap-to-rgba

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ndarray-bitmap-to-rgba) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ndarray-bitmap-to-rgba

stable

Convenience utility to expand 1-channel bitmap into RGBA pixmap. The default export returns white RGB pixels with the Alpha channel taken from the bitmap.

var expand = require('ndarray-bitmap-to-rgba')

//alpha bitmap -> rgba pixels
var pixmap = expand(bitmap)

//use red for the RGB channels
var pixmap = expand(bitmap, [ 0xff, 0x00, 0x00 ])

Alternatively, you can expand the bitmap into RGB channels, and use 0xFF for alpha:

var expand = require('ndarray-bitmap-to-rgba')

var pixmap = expand.opaque(bitmap)
//RGB = value in bitmap
//A   = 0xFF

Assumes Uint8 values.

Usage

NPM

rgba = expand.alpha(bitmap, [color])

Takes the bitmap ndarray and expands it to a RGBA pixmap where the alpha channel holds the bitmap.

You can pass color to specify the R, G, B channels. Defaults to white.

This is also the default export.

rgba = expand.opaque(bitmap)

Takes the bitmap ndarray and expands it to a RGBA pixmap where the RGB channels hold the bitmap, and the alpha channel is filled with 0xff.

License

MIT, see LICENSE.md for details.