Socket
Socket
Sign inDemoInstall

npm-image-generator

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    npm-image-generator

JavaScript random image generator


Version published
Maintainers
1
Created

Readme

Source

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);
    });
}

Keywords

FAQs

Last updated on 04 Mar 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc