rj

random-jpeg

a random jpeg generator

Showing:

Popularity

Downloads/wk

15

GitHub Stars

2

Maintenance

Last Commit

6yrs ago

Contributors

4

Package

Dependencies

2

Size (min+gzip)

26.3KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

random-jpeg

a random jpeg generator which generates jpegs with rectangular pattern.

example1

how to install

npm install random-jpeg --save

example

var randomJpeg = require('random-jpeg');

// with options and callback
var imageOptions = {
    colors: [[255, 0, 0],[255, 255, 255],[0, 0, 0],[0, 0, 255]],
    width: 800,
    height: 600,
    columns: 5,
    rows: 4,
    allowSameColorTouch: false,
    quality: 100
};
randomJpeg.writeJPEG(destination, imageOptions, callback);

// without any options or callback
randomJpeg.writeJPEG(destination);

methods

This module provides three public methods. two of them are using the imageOptions-object:

drawJPEG([imageOptions]){... return jpeg-buffer;};

writeJPEG(destination, [imageOptions], [callback]){ writes Filestream};

createBuffer([colorArray], [XPosArray], [YPosArray]){... return node-buffer;};
The length of the colorArray has to be (XPosArray.length - 1 * YPosArray.length - 1)

imageOptions

  • colors: Array of rgb-arrays [[r,g,b], [r,g,b]...,[r,g,b]], the selectable colors for the generator
  • width: width of resulting jpeg
  • height: width of resulting jpeg
  • columns: number of rectangles in x-direction
  • rows: number of rectangles in x-direction
  • allowSameColorTouch: are rectangles with the same color connected allowed
  • quality: jpeg encoding quality

example1

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100