image-augmentor

1.0.0 • Public • Published

image-augmentor

A Node.js module to apply random transformations to images. Useful data augmentation and data generation for machine learning

alt text alt text

Usage

const createImageAugmentor = require('image-augmentor');

const augmentor = createImageAugmentor({
    shearRange: 0.1,
    rotationRange: 90,
    blurRange: 0.1,
    backgroundColor: { r: 255, g:0, b:0, alpha: 0}
});

async function augment(){
const fs = require('fs');

    const source = await sharp (fs.readFileSync('./cat.png')).toBuffer();
    fs.writeFileSync('./augmented-cat.png', await augmentor(source));
}
augment();

Configuration:

const {
    shearRange = 0,
    rotationRange = 0,
    blurRange = 0,
    zoomRange = 0,
    sharpenRange = 0,
    brightnessRange = 0,
    saturationRange = 0,
    contrastRange = 0,
    transposeRange = 0,
    backgroundColor = {r: 255, g: 255, b: 255, alpha: 1}
}

Package Sidebar

Install

npm i image-augmentor

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

179 kB

Total Files

6

Last publish

Collaborators

  • kedem