node package manager
Loosely couple your services. Use Orgs to version and reuse your code. Create a free org »

to-rgba-array

To-rgba-array Build Status NPM version

Convert a variety of formats to an rgba array.

Purpose

Basically used to make plugins etc input format agnostic. Give it a canvas, an image in a buffer, a buffer with RGBA pixels, and it'll ensure you have a Uint8ClampedArray out.

Usage

var toRGBAArray = require('to-rgba-array');
var assert = require('assert');
 
var canvas = new Canvas(200,200);
toRGBAArray(canvas).then(function(result) {
  assert(result instanceof Uint8ClampedArray);
});;

API

to-rgba-array

module.exports(frame) ⇒ Promise.<Uint8ClampedArray>

Convert an input image into a Uint8ClampedArray containing RGBA pixels.

Kind: Exported function Returns: Promise.<Uint8ClampedArray> - The RGBA pixels.

Param Type Description
frame Canvas | Buffer The input image. Buffer can contain an image format (jpeg/png etc) or just RGBA pixels.

Note: To regenerate this section from the jsdoc run npm run docs and paste the output above.