Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/noblesamurai/to-rgba-array
Convert a variety of formats to an rgba array.
https://github.com/noblesamurai/to-rgba-array
Last synced: about 1 month ago
JSON representation
Convert a variety of formats to an rgba array.
- Host: GitHub
- URL: https://github.com/noblesamurai/to-rgba-array
- Owner: noblesamurai
- Created: 2017-02-02T04:15:26.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-17T01:41:20.000Z (over 6 years ago)
- Last Synced: 2024-11-15T17:42:44.507Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 120 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# To-rgba-array [![Build Status](https://secure.travis-ci.org/noblesamurai/to-rgba-array.png?branch=master)](http://travis-ci.org/noblesamurai/to-rgba-array) [![NPM version](https://badge-me.herokuapp.com/api/npm/to-rgba-array.png)](http://badges.enytc.com/for/npm/to-rgba-array)
> 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
```javascript
var toRGBAArray = require('to-rgba-array');
var assert = require('assert');var canvas = new Canvas(200,200);
const result = toRGBAArray(canvas);
assert(result instanceof Uint8ClampedArray);
```### module.exports(frame) ⇒
Uint8ClampedArray
⏏
Convert an input image into a Uint8ClampedArray containing RGBA pixels.**Kind**: Exported function
**Returns**: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.