Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
canvas-to-pixels
Advanced tools
Convert canvas actions into pixels
This is part of the gifsockets project. It is an alternative engine to the default phantomjs-pixel-server.
This module depends on node-canvas. Please satisfy its dependencies before using.
Documentation here: https://github.com/LearnBoost/node-canvas/wiki
Install the module with: npm install canvas-to-pixels
var canvasToPixels = require('canvas-to-pixels');
canvasToPixels({
width: 10,
height: 10,
js: (canvas, cb) {
var context = canvas.getContext('2d');
context.fillStyle = '#BADA55';
context.fillRect(0, 0, 10, 10);
cb();
}
}, function receivePixels (err, pixels) {
// pixels is [186,218,85,255,186,218, ..., 255]
});
canvas-to-pixels
returns canvasToPixels
as its module.exports
canvasToPixels(options, cb)
Run JavaScript function against canvas receive call back with PixelArray
Object
Number
- Width of canvas and output imageNumber
- Height of canvas and output imageObject
- Container for commands to run against a canvas
instance
function (canvas, cb) {}
String[]
- Array of parameter names for a function
canvas
instance with the provided width
and height
String
- Body of the function to execute
js.body
will write out the content you want to the canvasFunction
- Error-first callback that will receive PixelArray
function (err, pixels) {}
Error
- An error if any occurred while generating pixelsPixelArray
- An rgba
array of pixels values from the canvas
PixelArrays
behave just like normal arrays except they lack methods like concat
rgba
array is an array that contains subsequences of length 4 representing the red
, green
, blue
, and alpha
values for a pixel.
[0, 1, 2, 3, 4, 5, 6, 7]
is 2 pixels with r: 0, g: 1, b: 2, a: 3
and r: 4, g: 5, b: 6, a: 7
0
to 255
pixels
into a normal array, runvar normalArray = Array.prototype.slice.call(pixels);
Support this project and others by twolfson via gittip.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint via grunt and test via npm test
.
As of Nov 15 2013, Todd Wolfson has released this repository and its contents to the public domain.
It has been released under the UNLICENSE.
FAQs
Convert canvas actions into pixels
The npm package canvas-to-pixels receives a total of 4 weekly downloads. As such, canvas-to-pixels popularity was classified as not popular.
We found that canvas-to-pixels demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.