I'm writing a script that takes an image and creates multiple variants of different sizes (like imgur, basically). Right now, I do the following for each variant using https://github.com/aheckmann/gm in node.js:
function(file, size, newfile, callback) {
gm(file)
.noProfile()
.quality(80)
.resize(size, size)
.write(newfile, callback)
}
Here are two commandline examples how to do it with ImageMagick.
They use the mpr:
syntax supported by ImageMagick, which tells ImageMagick to temporarily save the input image into a named memory program register, from which it can later (while processing) read the data much faster than it could do from harddisk.
It should be easy for you to translate these commandlines into node.js parlance.