How to do composite with gm node.js?

前端 未结 6 1261
情话喂你
情话喂你 2020-12-24 08:22

How to do \'gm composite -gravity center change_image_url base_image_url\' with GM Node.js?

How to call gm().command() & gm().in() or <

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-24 09:19

    After struggling for an hour, here is my solution for your question:

    gm composite -gravity center change_image_url base_image_url
    
    gm()
    .command("composite") 
    .in("-gravity", "center")
    .in(change_image_url)
    .in(base_image_url)
    .write( output_file, function (err) {
      if (!err) 
        console.log(' hooray! ');
      else
        console.log(err);
    });
    

    Good luck! Hope it will be helpful to others as well :)

提交回复
热议问题