1.0.0 • Published 10 months ago

image-augmentor v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

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}
}
1.0.0

10 months ago