Currently, I am using the gm npm module for image manipulation and have written this code:
for(i=0;i < 4;i++){
gm("www/img/" + image[i]).crop(550, 406, 0, 0).write(function(err) {
console.log(this.outname + " created :: " + arguments[3]); //success
});
}
The purpose of this loop is to iterate through the images array and crop each photo, but it seems to only crop the last one. It appears that the issue may be related to function invocation and callbacks, although I haven't reached an advanced level in understanding these concepts yet.