Package Exports
- js-image-generator
- js-image-generator/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (js-image-generator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
js-image-generator
This is a node module for generating random images.
- Works platform independent
- Needs no building thanks to jpeg-js
- Generates random colored, noisy images
I needed this for creating dummy datasets including images in combination with faker.js and / or choice.js
Uses the jpeg-js library: https://github.com/eugeneware/jpeg-js
Installation
npm install js-image-generator
Example Usage
var fs = require('fs');
var imgGen = require('js-image-generator');
// Generate one image
imgGen.generateImage(800, 600, 80, function(err, image) {
fs.writeFileSync('dummy.jpg', image.data);
});
// Generate multiple images
for(var i=1;i<=10;i++){
imgGen.generateImage(800, 600, 80, function(err, image) {
console.log("Generating image #" +i);
fs.writeFileSync('dummy-' + i + '.jpg', image.data);
});
}