img-workshop
v0.2.1
Published
Simple automatic image processing
Downloads
2
Readme
img-workshop
This is a simple helper library to dynamically process images. It watches an input folder (or fileglob), applies some arbitrary processing to each image, and saves the result in an output folder. Whenever one of the source files changes, the processing is re-applied.
Installation
brew install graphicsmagick
npm install img-workshop
Usage
To invoke from code:
var watch = require('img-workshop')
var gm = require('gm')
var input = './inputs/**/*.png' // file, folder, or glob
var output = './outputs/' // folder
var proc = function(path) {
var img = gm(path)
.blur(5)
.flip() // or whatever
.clip()
return img
}
watch( input, output, proc )
To use as an ad-hoc standalone library:
- Open
index.js
and edit theINPUT
andOUTPUT
settings - Open
processor.js
and fill in whatever image processing you want - run
npm start
from the project folder
Either way, image processing is done with gm, a node wrapper for graphicsmagick.
To see what can be done check the API docs.