This is basic imagemagick setup for node.js that i came across lately. I understand that question i'm asking is very newbie but i'm new to node js and imagemagick and i wanted to try to make it dynamic. Current script bellow is cropping one specific file, is there a way to make it to apply conversion to all the files from directory /before and then output it to directory /after ? Also the operation i want to do for all the images in directory is to apply watermark on each (crop operation in code is just from example).
var http = require("http"); var im = require("imagemagick"); var args = [ "image.png", "-crop", "120x80+30+15", "output.png" ]; var server = http.createServer(function(req, res) { im.convert(args, function(err) { if(err) { throw err; } res.end("Image crop complete"); }); }).listen(8080);