A lot of solutions are pointing toward's using mogrify, which would work great if it was part of the Node js implementation. All I need to do is resize my images and retain the file names, but place them in a separate "resized" folder. Here's what I'm doing here (in coffeescript, as a plugin for DocPad static website generator):
# Export Plugin
module.exports = (BasePlugin) ->
im = require 'imagemagick'
# Define Plugin
class ImageMagickPlugin extends BasePlugin
# Plugin name
name: 'imagemagick'
im.resize
srcPath: './src/files/images/source/*.jpg'
dstPath: "./src/files/images/resized/.jpg"
width: 256
, (err, stdout, stderr) ->
throw err if err
console.log "resized some files to fit within 256"
The result is that my images are resized properly, and placed in the correct folder, but the names themselves are "-0.jpg, -1.jpg, -2.jpg", and so on. I'm really writing this for our own specific use, rather than a serious plugin for DocPad, though I think when it's working well we can definitely modify it for general use.
I appreciate any help!
Thanks