Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
canvassmith
Advanced tools
Readme
node-canvas engine for spritesmith.
By default, binaries for macOS, Linux and Windows will be downloaded. But if you don't have a supported OS or processor architecture the module will be compiled on your system. This requires several dependencies from node-canvas, you must install Cairo and Pango.
Instructions on how to do this are provided in the node-canvas wiki.
Additionally, you will need to install node-gyp.
npm install -g node-gyp
Install the module with: npm install canvassmith
// Load in our dependencies
var Canvassmith = require('canvassmith');
// Create a new engine
var canvassmith = new Canvassmith();
// Interpret some images from disk
canvassmith.createImages(['img1.jpg', 'img2.png'], function handleImages (err, imgs) {
// If there was an error, throw it
if (err) {
throw err;
}
// We recieve images in the same order they were given
imgs[0].width; // 50 (pixels)
imgs[0].height; // 100 (pixels)
// Create a canvas that fits our images (200px wide, 300px tall)
var canvas = canvassmith.createCanvas(200, 300);
// Add the images to our canvas (at x=0, y=0 and x=50, y=100 respectively)
canvas.addImage(imgs[0], 0, 0);
canvas.addImage(imgs[1], 50, 100);
// Export canvas to image
var resultStream = canvas['export']({format: 'png'});
resultStream; // Readable stream outputting PNG image of the canvas
});
This module was built to the specification for spritesmith engines.
Specification version: 2.0.0
https://github.com/twolfson/spritesmith-engine-spec/tree/2.0.0
engine.createImages(images, cb)
Our createImages
methods supports the following types of images:
String
- Filepath to imageObject
- Vinyl object with buffer for image (uses buffer)Object
- Vinyl object with stream for image (uses stream)Object
- Vinyl object with null
for image (reads buffer from provided filepath)In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint using npm run lint
and test via npm test
.
Support this project and others by twolfson via donations.
http://twolfson.com/support-me
Copyright (c) 2013 Todd Wolfson
Licensed under the MIT license.
FAQs
node-canvas engine for spritesmith
The npm package canvassmith receives a total of 271 weekly downloads. As such, canvassmith popularity was classified as not popular.
We found that canvassmith 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.