
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
GM engine for spritesmith.
gmsmith
depends on gm which depends on GraphicsMagick.
I have found it is best to install from the site rather than through a package manager (e.g. apt-get
) to get the latest as well as without transparency issues.
This module has been developed and tested against 1.3.17
.
Alertnatively, you can use ImageMagick which is implicitly discovered if
gm
is not installed. http://www.imagemagick.org/script/index.php
Install the module with: npm install gmsmith
// Load in our dependencies
var Gmsmith = require('gmsmith');
// Create a new engine
var gmsmith = new Gmsmith();
// Interpret some images from disk
gmsmith.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 = gmsmith.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
new Engine(options)
This is also known as new Gmsmith
.
Our Engine
constructor provides support for the following options:
Object
Boolean
- Flag to indicate whether to use ImageMagick over GraphicsMagick
true
, ImageMagick will be used. Otherwise, implicit discovery will be used.engine.createImages(images, cb)
Our createImages
methods supports the following types of images:
String
- Filepath to imageObject
- Vinyl object with null
for image (uses provided filepath)We accept but don't fully support the following types of images:
Object
- Vinyl object with buffer for image (ignores contents, uses provided filepath)Object
- Vinyl object with stream for image (ignores contents, uses provided filepath)canvas.export(options)
Our export
method provides support for the following options:
Object
String
- Output image format to callback with. Currently, png and jpeg are available.Number
- Quality of output image on a scale from 0 to 100In 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
GM engine for spritesmith
The npm package gmsmith receives a total of 3,671 weekly downloads. As such, gmsmith popularity was classified as popular.
We found that gmsmith 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.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.