0.2.1 • Published 10 years ago
img-workshop v0.2.1
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-workshopUsage
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.jsand edit theINPUTandOUTPUTsettings - Open
processor.jsand fill in whatever image processing you want - run
npm startfrom 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.