image-augmentor
v1.0.0
Published
A Node.js module to apply random transformations to images.
Downloads
4
Maintainers
Readme
image-augmentor
A Node.js module to apply random transformations to images. Useful data augmentation and data generation for machine learning
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}
}