Open Nedvedyy opened 9 years ago
That's because you're passing this
which is out of context from gm. Try this
var img, paraArray = [], gm = require('gm');
/** push to array here **/
img = gm('./sprites/tn_1.png');
img.append.apply(img, paraArray);
/** continue to use img here to write/do whatever else you want **/
Hi,
I have an array of images which I want to merge into 1. As the number of elements is not fixed, I am using
var paraArray = []; .... push the path of the images to the array. gm('./sprites/tn_1.png').append.apply(this,paraArray) gives the error
/Users/..../node_modules/gm/lib/args.js:64 this.addSrcFormatter(function (src) { ^ TypeError: Object #
If I call gm('./sprites/tn_1.png').append('./sprites/tn_2.png','./sprites/tn_3.png','./sprites/tn_4.png'), it works good. Any idea?
Regards Ned